comparison tools/lib64gfx.c @ 1720:77a4d8fab5cc

Add output buffer cropping to dmFinishRLEBuffers() and the flags and fields to DMGrowBuf.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 06 Jun 2018 15:19:40 +0300
parents bed88d17f28c
children c9a6f1dae756
comparison
equal deleted inserted replaced
1719:8f47bd264458 1720:77a4d8fab5cc
347 { 347 {
348 if (cfg->flags & DM_RLE_BACKWARDS_OUTPUT) 348 if (cfg->flags & DM_RLE_BACKWARDS_OUTPUT)
349 { 349 {
350 memmove(dst->data, dst->data + dst->offs, dst->len); 350 memmove(dst->data, dst->data + dst->offs, dst->len);
351 dst->offs = 0; 351 dst->offs = 0;
352 }
353
354 switch (cfg->flags & DM_OUT_CROP_MASK)
355 {
356 case DM_OUT_CROP_END:
357 if (cfg->cropOutLen < dst->len)
358 {
359 memmove(dst->data, dst->data + dst->len - cfg->cropOutLen + 1, cfg->cropOutLen);
360 dst->len = cfg->cropOutLen;
361 }
362 break;
363
364 case DM_OUT_CROP_START:
365 if (cfg->cropOutLen <= dst->len)
366 dst->len = cfg->cropOutLen;
367 break;
352 } 368 }
353 } 369 }
354 370
355 371
356 int dmGenericRLEOutputRun(DMGrowBuf *dst, const DMCompParams *cfg, const Uint8 data, const unsigned int count) 372 int dmGenericRLEOutputRun(DMGrowBuf *dst, const DMCompParams *cfg, const Uint8 data, const unsigned int count)