# HG changeset patch # User Matti Hamalainen # Date 1528287580 -10800 # Node ID 77a4d8fab5cccf6923aa443790e00fa9e6d0aa3e # Parent 8f47bd264458261d37d4d593ccd532f38e23b287 Add output buffer cropping to dmFinishRLEBuffers() and the flags and fields to DMGrowBuf. diff -r 8f47bd264458 -r 77a4d8fab5cc tools/lib64gfx.c --- 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; + } } diff -r 8f47bd264458 -r 77a4d8fab5cc tools/lib64gfx.h --- a/tools/lib64gfx.h Wed Jun 06 15:18:25 2018 +0300 +++ b/tools/lib64gfx.h Wed Jun 06 15:19:40 2018 +0300 @@ -232,6 +232,11 @@ DM_RLE_BACKWARDS_INPUT = 0x0100, DM_RLE_BACKWARDS_OUTPUT = 0x0200, + + DM_OUT_CROP_NONE = 0x0000, + DM_OUT_CROP_START = 0x1000, + DM_OUT_CROP_END = 0x2000, + DM_OUT_CROP_MASK = 0xf000, }; @@ -240,6 +245,8 @@ char *func; int type; int flags; + size_t cropOutLen; + Uint8 // DM_COMP_RLE_MARKER mode rleMarkerB, // Marker byte for byte length runs (if DM_RLE_BYTE_RUNS used)