Mercurial > hg > dmlib
comparison tools/lib64fmts.c @ 1711:4fd94bf558b3
Add function name field to DMCompParams struct and set it in places where we use DMCompParams.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Wed, 06 Jun 2018 14:28:19 +0300 |
parents | a0986cfd6f9d |
children | 1f4ed247763d |
comparison
equal
deleted
inserted
replaced
1710:1f0fac3af8e3 | 1711:4fd94bf558b3 |
---|---|
51 DMCompParams cfg; | 51 DMCompParams cfg; |
52 | 52 |
53 cfg.type = DM_COMP_RLE_MARKER; | 53 cfg.type = DM_COMP_RLE_MARKER; |
54 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_2; | 54 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_2; |
55 cfg.rleMarkerB = 0xfe; | 55 cfg.rleMarkerB = 0xfe; |
56 cfg.func = fmt->name; | |
56 | 57 |
57 if ((res = dmDecodeGenericRLEAlloc(&mem, buf, &cfg)) != DMERR_OK) | 58 if ((res = dmDecodeGenericRLEAlloc(&mem, buf, &cfg)) != DMERR_OK) |
58 goto out; | 59 goto out; |
59 | 60 |
60 res = dmC64DecodeGenericBMP(img, &mem, fmt); | 61 res = dmC64DecodeGenericBMP(img, &mem, fmt); |
74 // Encode the data to temp buffer | 75 // Encode the data to temp buffer |
75 if ((res = dmC64EncodeGenericBMP(TRUE, &tmp, img, fmt)) != DMERR_OK) | 76 if ((res = dmC64EncodeGenericBMP(TRUE, &tmp, img, fmt)) != DMERR_OK) |
76 goto out; | 77 goto out; |
77 | 78 |
78 // And now RLE compress the data to the existing buffer | 79 // And now RLE compress the data to the existing buffer |
80 cfg.func = fmt->name; | |
79 cfg.type = DM_COMP_RLE_MARKER; | 81 cfg.type = DM_COMP_RLE_MARKER; |
80 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_2; | 82 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_2; |
81 cfg.rleMarkerB = 0xfe; | 83 cfg.rleMarkerB = 0xfe; |
82 cfg.rleMinCountB = 3; | 84 cfg.rleMinCountB = 3; |
83 cfg.rleMaxCountB = 255; | 85 cfg.rleMaxCountB = 255; |
112 DMCompParams cfg; | 114 DMCompParams cfg; |
113 | 115 |
114 cfg.type = DM_COMP_RLE_MARKER; | 116 cfg.type = DM_COMP_RLE_MARKER; |
115 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; | 117 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; |
116 cfg.rleMarkerB = buf->data[0x0d]; | 118 cfg.rleMarkerB = buf->data[0x0d]; |
119 cfg.func = fmt->name; | |
117 | 120 |
118 if ((res = dmDecodeGenericRLEAlloc(&mem, | 121 if ((res = dmDecodeGenericRLEAlloc(&mem, |
119 dmGrowBufCreateFromOffs(&tmp, buf, 0x0e), &cfg)) != DMERR_OK) | 122 dmGrowBufCreateFromOffs(&tmp, buf, 0x0e), &cfg)) != DMERR_OK) |
120 goto out; | 123 goto out; |
121 | 124 |
137 // Encode the data to temp buffer | 140 // Encode the data to temp buffer |
138 if ((res = dmC64EncodeGenericBMP(TRUE, &tmp, img, fmt)) != DMERR_OK) | 141 if ((res = dmC64EncodeGenericBMP(TRUE, &tmp, img, fmt)) != DMERR_OK) |
139 goto out; | 142 goto out; |
140 | 143 |
141 // Analyze and setup RLE | 144 // Analyze and setup RLE |
145 cfg.func = fmt->name; | |
142 cfg.type = DM_COMP_RLE_MARKER; | 146 cfg.type = DM_COMP_RLE_MARKER; |
143 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; | 147 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; |
144 cfg.rleMinCountB = 3; | 148 cfg.rleMinCountB = 3; |
145 cfg.rleMaxCountB = 255; | 149 cfg.rleMaxCountB = 255; |
146 | 150 |
213 | 217 |
214 cfg.type = DM_COMP_RLE_MARKER; | 218 cfg.type = DM_COMP_RLE_MARKER; |
215 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_WORD_RUNS | DM_RLE_ORDER_1; | 219 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_WORD_RUNS | DM_RLE_ORDER_1; |
216 cfg.rleMarkerB = buf->data[8]; | 220 cfg.rleMarkerB = buf->data[8]; |
217 cfg.rleMarkerW = buf->data[9]; | 221 cfg.rleMarkerW = buf->data[9]; |
222 cfg.func = fmt->name; | |
218 | 223 |
219 if ((res = dmDecodeGenericRLEAlloc(&mem, | 224 if ((res = dmDecodeGenericRLEAlloc(&mem, |
220 dmGrowBufCreateFromOffs(&tmp, buf, 10), &cfg)) != DMERR_OK) | 225 dmGrowBufCreateFromOffs(&tmp, buf, 10), &cfg)) != DMERR_OK) |
221 goto out; | 226 goto out; |
222 | 227 |
237 // Encode the data to temp buffer | 242 // Encode the data to temp buffer |
238 if ((res = dmC64EncodeGenericBMP(TRUE, &mem, img, fmt)) != DMERR_OK) | 243 if ((res = dmC64EncodeGenericBMP(TRUE, &mem, img, fmt)) != DMERR_OK) |
239 goto out; | 244 goto out; |
240 | 245 |
241 // Analyze and setup RLE | 246 // Analyze and setup RLE |
247 cfg.func = fmt->name; | |
242 cfg.type = DM_COMP_RLE_MARKER; | 248 cfg.type = DM_COMP_RLE_MARKER; |
243 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_WORD_RUNS | DM_RLE_ORDER_1; | 249 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_WORD_RUNS | DM_RLE_ORDER_1; |
244 cfg.rleMinCountB = 3; | 250 cfg.rleMinCountB = 3; |
245 cfg.rleMaxCountB = 255; | 251 cfg.rleMaxCountB = 255; |
246 cfg.rleMinCountW = 256; | 252 cfg.rleMinCountW = 256; |
319 | 325 |
320 // Now do an RLE decode on the enlarged buffer | 326 // Now do an RLE decode on the enlarged buffer |
321 cfg.type = DM_COMP_RLE_MARKER; | 327 cfg.type = DM_COMP_RLE_MARKER; |
322 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; | 328 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; |
323 cfg.rleMarkerB = 0xC2; | 329 cfg.rleMarkerB = 0xC2; |
330 cfg.func = fmt->name; | |
324 | 331 |
325 if ((res = dmDecodeGenericRLEAlloc(&mem, &tmp, &cfg)) != DMERR_OK) | 332 if ((res = dmDecodeGenericRLEAlloc(&mem, &tmp, &cfg)) != DMERR_OK) |
326 goto out; | 333 goto out; |
327 | 334 |
328 // And finally decode to bitmap struct | 335 // And finally decode to bitmap struct |
344 // Encode the data to temp buffer | 351 // Encode the data to temp buffer |
345 if ((res = dmC64EncodeGenericBMP(TRUE, &mem, img, fmt)) != DMERR_OK) | 352 if ((res = dmC64EncodeGenericBMP(TRUE, &mem, img, fmt)) != DMERR_OK) |
346 goto out; | 353 goto out; |
347 | 354 |
348 // And now RLE compress the data to the existing buffer | 355 // And now RLE compress the data to the existing buffer |
356 cfg.func = fmt->name; | |
349 cfg.type = DM_COMP_RLE_MARKER; | 357 cfg.type = DM_COMP_RLE_MARKER; |
350 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; | 358 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; |
351 cfg.rleMarkerB = 0xC2; | 359 cfg.rleMarkerB = 0xC2; |
352 cfg.rleMinCountB = 3; | 360 cfg.rleMinCountB = 3; |
353 cfg.rleMaxCountB = 255; | 361 cfg.rleMaxCountB = 255; |
594 DMCompParams cfg; | 602 DMCompParams cfg; |
595 | 603 |
596 cfg.type = DM_COMP_RLE_MARKER; | 604 cfg.type = DM_COMP_RLE_MARKER; |
597 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; | 605 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; |
598 cfg.rleMarkerB = buf->data[15]; | 606 cfg.rleMarkerB = buf->data[15]; |
607 cfg.func = fmt->name; | |
599 | 608 |
600 if ((res = dmDecodeGenericRLEAlloc( | 609 if ((res = dmDecodeGenericRLEAlloc( |
601 &mem, dmGrowBufCreateFromOffs(&tmp, buf, FUNPAINT2_HEADER_SIZE), &cfg)) == DMERR_OK) | 610 &mem, dmGrowBufCreateFromOffs(&tmp, buf, FUNPAINT2_HEADER_SIZE), &cfg)) == DMERR_OK) |
602 res = dmC64DecodeGenericBMP(img, &mem, fmt); | 611 res = dmC64DecodeGenericBMP(img, &mem, fmt); |
603 | 612 |
632 // Encode the data to temp buffer | 641 // Encode the data to temp buffer |
633 if ((res = dmC64EncodeGenericBMP(TRUE, &mem, img, fmt)) != DMERR_OK) | 642 if ((res = dmC64EncodeGenericBMP(TRUE, &mem, img, fmt)) != DMERR_OK) |
634 goto out; | 643 goto out; |
635 | 644 |
636 // Analyze and setup RLE | 645 // Analyze and setup RLE |
646 cfg.func = fmt->name; | |
637 cfg.type = DM_COMP_RLE_MARKER; | 647 cfg.type = DM_COMP_RLE_MARKER; |
638 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; | 648 cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_1; |
639 cfg.rleMinCountB = 3; | 649 cfg.rleMinCountB = 3; |
640 cfg.rleMaxCountB = 255; | 650 cfg.rleMaxCountB = 255; |
641 | 651 |