# HG changeset patch # User Matti Hamalainen # Date 1529683283 -10800 # Node ID 666b279995706d33bfbfd29a2f3ab98c2687951e # Parent d02514ceed91a3dfa44c24bb415dacd4a0b058f7 As the Koala Painter plain RLE compression (without headers and static marker value) is used in various others formats, make the functions generic. diff -r d02514ceed91 -r 666b27999570 tools/lib64fmts.c --- a/tools/lib64fmts.c Fri Jun 22 18:21:36 2018 +0300 +++ b/tools/lib64fmts.c Fri Jun 22 19:01:23 2018 +0300 @@ -23,7 +23,7 @@ } -static int fmtDecodeKoalaPainterPacked(DMC64Image *img, const DMGrowBuf *buf, const DMC64ImageFormat *fmt) +static int fmtDecodeStaticRLEMarkerMode2(DMC64Image *img, const DMGrowBuf *buf, const DMC64ImageFormat *fmt) { int res; DMGrowBuf mem; @@ -32,7 +32,7 @@ cfg.func = fmt->name; cfg.type = DM_COMP_RLE_MARKER; cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_2; - cfg.rleMarkerB = 0xfe; + cfg.rleMarkerB = fmt->size; if ((res = dmDecodeGenericRLEAlloc(&mem, buf, &cfg)) != DMERR_OK) goto out; @@ -45,7 +45,7 @@ } -static int fmtEncodeKoalaPainterPacked(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt) +static int fmtEncodeStaticRLEMarkerMode2(DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt) { int res; DMGrowBuf tmp; @@ -59,7 +59,7 @@ cfg.func = fmt->name; cfg.type = DM_COMP_RLE_MARKER; cfg.flags = DM_RLE_BYTE_RUNS | DM_RLE_ORDER_2; - cfg.rleMarkerB = 0xfe; + cfg.rleMarkerB = fmt->size; cfg.rleMinCountB = 3; cfg.rleMaxCountB = 255; res = dmEncodeGenericRLE(buf, &tmp, &cfg); @@ -1257,9 +1257,9 @@ }, { - "klp", "Koala Painter (packed)", 0x6000, 0, DM_FMT_RDWR, + "klp", "Koala Painter (packed)", 0x6000, 0xfe, DM_FMT_RDWR, // size is abused for RLE marker byte fmtProbeKoalaPainterPacked, - fmtDecodeKoalaPainterPacked, fmtEncodeKoalaPainterPacked, + fmtDecodeStaticRLEMarkerMode2, fmtEncodeStaticRLEMarkerMode2, { }, &dmC64CommonFormats[0] },