Mercurial > hg > dmlib
diff 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 |
line wrap: on
line diff
--- a/tools/lib64gfx.c Wed Jun 06 15:18:25 2018 +0300 +++ b/tools/lib64gfx.c Wed Jun 06 15:19:40 2018 +0300 @@ -350,6 +350,22 @@ memmove(dst->data, dst->data + dst->offs, dst->len); dst->offs = 0; } + + switch (cfg->flags & DM_OUT_CROP_MASK) + { + case DM_OUT_CROP_END: + if (cfg->cropOutLen < dst->len) + { + memmove(dst->data, dst->data + dst->len - cfg->cropOutLen + 1, cfg->cropOutLen); + dst->len = cfg->cropOutLen; + } + break; + + case DM_OUT_CROP_START: + if (cfg->cropOutLen <= dst->len) + dst->len = cfg->cropOutLen; + break; + } }