comparison tools/lib64gfx.c @ 1747:5e928618fdc8

Change DMGrowBuf API somewhat and implement more copy operations.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 11 Jun 2018 13:57:07 +0300
parents e40227e994e2
children b9f3c1796fba
comparison
equal deleted inserted replaced
1746:dd57dd9430cb 1747:5e928618fdc8
1371 { 1371 {
1372 // Nope, perform a generic probe 1372 // Nope, perform a generic probe
1373 if (probeOffs >= buf->len) 1373 if (probeOffs >= buf->len)
1374 return DMERR_OUT_OF_DATA; 1374 return DMERR_OUT_OF_DATA;
1375 1375
1376 dmGrowBufCreateFromOffs(&tmp, buf, probeOffs); 1376 dmGrowBufConstCopyOffs(&tmp, buf, probeOffs);
1377 if (dmC64ProbeBMP(tmp.data, tmp.len, fmt) == DM_PROBE_SCORE_FALSE) 1377 if (dmC64ProbeBMP(tmp.data, tmp.len, fmt) == DM_PROBE_SCORE_FALSE)
1378 return DMERR_NOT_SUPPORTED; 1378 return DMERR_NOT_SUPPORTED;
1379 } 1379 }
1380 1380
1381 if (loadOffs >= buf->len) 1381 if (loadOffs >= buf->len)
1390 1390
1391 // Allocate memory 1391 // Allocate memory
1392 if ((*img = dmC64ImageAlloc(*fmt)) == NULL) 1392 if ((*img = dmC64ImageAlloc(*fmt)) == NULL)
1393 return DMERR_MALLOC; 1393 return DMERR_MALLOC;
1394 1394
1395 dmGrowBufCreateFromOffs(&tmp, buf, loadOffs); 1395 dmGrowBufConstCopyOffs(&tmp, buf, loadOffs);
1396 1396
1397 // Decode the bitmap to memory layout 1397 // Decode the bitmap to memory layout
1398 if ((*fmt)->decode != NULL) 1398 if ((*fmt)->decode != NULL)
1399 return (*fmt)->decode(*img, &tmp, *fmt); 1399 return (*fmt)->decode(*img, &tmp, *fmt);
1400 else 1400 else