changeset 1486:bc13af8954d7

Add DMC64ImageFormat to C64 bitmap format encoding/decoding ops function parameters.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 11 May 2018 04:52:43 +0300
parents 06a9c16601d6
children 06df2bdf5dc4
files tools/lib64gfx.c tools/lib64gfx.h
diffstat 2 files changed, 13 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/tools/lib64gfx.c	Fri May 11 04:23:47 2018 +0300
+++ b/tools/lib64gfx.c	Fri May 11 04:52:43 2018 +0300
@@ -461,9 +461,11 @@
 }
 
 
-static BOOL fmtDrazLaceSetLaceType(DMC64Image *img, const struct _DMC64EncDecOp *op, const Uint8 *buf, const size_t len)
+static BOOL fmtDrazLaceSetLaceType(DMC64Image *img, const DMC64EncDecOp *op,
+    const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
 {
     (void) len;
+    (void) fmt;
     img->laceType = buf[op->offs] ? D64_ILACE_RES : D64_ILACE_COLOR;
     return TRUE;
 }
@@ -544,11 +546,13 @@
 }
 
 
-static BOOL fmtTruePaintSetLaceType(DMC64Image *img, const struct _DMC64EncDecOp *op, const Uint8 *buf, const size_t len)
+static BOOL fmtTruePaintSetLaceType(DMC64Image *img, const DMC64EncDecOp *op,
+    const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
 {
     (void) op;
     (void) buf;
     (void) len;
+    (void) fmt;
     img->laceType = D64_ILACE_RES;
     return TRUE;
 }
@@ -1406,7 +1410,7 @@
                         "op #%d, offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x)\n",
                         i, op->offs, op->offs, op->bank, size, size, len, len);
                 }
-                if (!op->decFunction(img, op, buf, len))
+                if (!op->decFunction(img, op, buf, len, fmt))
                 {
                     return dmError(DMERR_INTERNAL,
                         "Decode op custom function failed: op #%d, "
@@ -1540,13 +1544,13 @@
                     goto err;
                 }
                 /*
-                if (!op->encFunction(op, buf, len))
+                if (!op->encFunction(op, buf, img, fmt))
                 {
                     res = dmError(DMERR_INTERNAL,
                         "Encode op custom function failed: op #%d, "
                         "offs=%d ($%04x), bank=%d, size=%d ($%04x) @ %d ($%04x)\n",
-                        i, op->offs, op->offs, op->bank, size, size, len, len);
-                    goto out;
+                        i, op->offs, op->offs, op->bank, size, size, buf->len, buf->len);
+                    goto err;
                 }
                 */
                 break;
--- a/tools/lib64gfx.h	Fri May 11 04:23:47 2018 +0300
+++ b/tools/lib64gfx.h	Fri May 11 04:52:43 2018 +0300
@@ -151,6 +151,7 @@
 
 #define D64_MAX_ENCDEC_OPS 64
 
+typedef struct _DMC64ImageFormat DMC64ImageFormat;
 
 typedef struct _DMC64EncDecOp
 {
@@ -158,8 +159,8 @@
     size_t offs;
     int    bank;
     size_t size;
-    BOOL   (*decFunction)(DMC64Image *img, const struct _DMC64EncDecOp *op, const Uint8 *buf, const size_t len);
-    BOOL   (*encFunction)(const struct _DMC64EncDecOp *op, Uint8 **buf, size_t *len, const DMC64Image *img);
+    BOOL   (*decFunction)(DMC64Image *img, const struct _DMC64EncDecOp *op, const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt);
+    BOOL   (*encFunction)(const struct _DMC64EncDecOp *op, DMGrowBuf *buf, const DMC64Image *img, const DMC64ImageFormat *fmt);
 } DMC64EncDecOp;