comparison tools/lib64gfx.c @ 1783:1ce808599129

Add DM_RLE_ZERO_COUNT_MAX flag for RLE decoder which makes it interpret run lengths of 0 as maximum value of the type, e.g. 256 or 65536 (latter is probably useless.)
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 13 Jun 2018 01:34:46 +0300
parents 5ea4713e9e0f
children 523c1d1270d6
comparison
equal deleted inserted replaced
1782:22b6fa1a2ee4 1783:1ce808599129
472 case DM_RLE_ORDER_2: 472 case DM_RLE_ORDER_2:
473 data = tmp1; 473 data = tmp1;
474 count = tmp2; 474 count = tmp2;
475 break; 475 break;
476 } 476 }
477
478 if (count == 0 && (cfg->flags & DM_RLE_ZERO_COUNT_MAX))
479 count = 256;
477 } 480 }
478 else 481 else
479 if ((cfg->flags & DM_RLE_WORD_RUNS) && data == cfg->rleMarkerW) 482 if ((cfg->flags & DM_RLE_WORD_RUNS) && data == cfg->rleMarkerW)
480 { 483 {
481 if (!dmGrowBufGetU8(&src, &tmp1) || 484 if (!dmGrowBufGetU8(&src, &tmp1) ||
497 case DM_RLE_ORDER_2: 500 case DM_RLE_ORDER_2:
498 data = tmp1; 501 data = tmp1;
499 count = (tmp3 << 8) | tmp2; 502 count = (tmp3 << 8) | tmp2;
500 break; 503 break;
501 } 504 }
505
506 if (count == 0 && (cfg->flags & DM_RLE_ZERO_COUNT_MAX))
507 count = 65536;
502 } 508 }
503 } 509 }
504 else 510 else
505 if (cfg->type == DM_COMP_RLE_MASK) 511 if (cfg->type == DM_COMP_RLE_MASK)
506 { 512 {