Mercurial > hg > dmlib
comparison tools/lib64fmts.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 | dd57dd9430cb |
children | 9c4b3fecc510 |
comparison
equal
deleted
inserted
replaced
1746:dd57dd9430cb | 1747:5e928618fdc8 |
---|---|
96 cfg.type = DM_COMP_RLE_MARKER; | 96 cfg.type = DM_COMP_RLE_MARKER; |
97 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; | 97 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; |
98 cfg.rleMarkerB = buf->data[0x0d]; | 98 cfg.rleMarkerB = buf->data[0x0d]; |
99 | 99 |
100 if ((res = dmDecodeGenericRLEAlloc(&mem, | 100 if ((res = dmDecodeGenericRLEAlloc(&mem, |
101 dmGrowBufCreateFromOffs(&tmp, buf, 0x0e), &cfg)) != DMERR_OK) | 101 dmGrowBufConstCopyOffs(&tmp, buf, 0x0e), &cfg)) != DMERR_OK) |
102 goto out; | 102 goto out; |
103 | 103 |
104 res = dmC64DecodeGenericBMP(img, &mem, fmt); | 104 res = dmC64DecodeGenericBMP(img, &mem, fmt); |
105 | 105 |
106 out: | 106 out: |
199 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_WORD_RUNS | DM_RLE_ORDER_1; | 199 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_WORD_RUNS | DM_RLE_ORDER_1; |
200 cfg.rleMarkerB = buf->data[8]; | 200 cfg.rleMarkerB = buf->data[8]; |
201 cfg.rleMarkerW = buf->data[9]; | 201 cfg.rleMarkerW = buf->data[9]; |
202 | 202 |
203 if ((res = dmDecodeGenericRLEAlloc(&mem, | 203 if ((res = dmDecodeGenericRLEAlloc(&mem, |
204 dmGrowBufCreateFromOffs(&tmp, buf, 10), &cfg)) != DMERR_OK) | 204 dmGrowBufConstCopyOffs(&tmp, buf, 10), &cfg)) != DMERR_OK) |
205 goto out; | 205 goto out; |
206 | 206 |
207 res = dmC64DecodeGenericBMP(img, &mem, fmt); | 207 res = dmC64DecodeGenericBMP(img, &mem, fmt); |
208 | 208 |
209 out: | 209 out: |
581 | 581 |
582 dmGrowBufFree(&mem); | 582 dmGrowBufFree(&mem); |
583 } | 583 } |
584 else | 584 else |
585 { | 585 { |
586 res = dmC64DecodeGenericBMP(img, dmGrowBufCreateFromOffs(&tmp, buf, FUNPAINT2_HEADER_SIZE), fmt); | 586 res = dmC64DecodeGenericBMP(img, dmGrowBufConstCopyOffs(&tmp, buf, FUNPAINT2_HEADER_SIZE), fmt); |
587 } | 587 } |
588 | 588 |
589 return res; | 589 return res; |
590 } | 590 } |
591 | 591 |
804 cfg.type = DM_COMP_RLE_MARKER; | 804 cfg.type = DM_COMP_RLE_MARKER; |
805 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; | 805 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; |
806 cfg.rleMarkerB = buf->data[0]; | 806 cfg.rleMarkerB = buf->data[0]; |
807 | 807 |
808 if ((res = dmDecodeGenericRLEAlloc( | 808 if ((res = dmDecodeGenericRLEAlloc( |
809 &mem, dmGrowBufCreateFromOffs(&tmp, buf, 1), &cfg)) == DMERR_OK) | 809 &mem, dmGrowBufConstCopyOffs(&tmp, buf, 1), &cfg)) == DMERR_OK) |
810 res = dmC64DecodeGenericBMP(img, &mem, fmt); | 810 res = dmC64DecodeGenericBMP(img, &mem, fmt); |
811 | 811 |
812 dmGrowBufFree(&mem); | 812 dmGrowBufFree(&mem); |
813 return res; | 813 return res; |
814 } | 814 } |