diff tools/lib64gfx.h @ 1592:91d1bb571fca

Implement common encdec ops lists for sharing oplists between formats that use the exact same ops.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 14 May 2018 06:36:18 +0300
parents 3cc7b2aadda3
children 58ef0124394d
line wrap: on
line diff
--- a/tools/lib64gfx.h	Mon May 14 05:53:22 2018 +0300
+++ b/tools/lib64gfx.h	Mon May 14 06:36:18 2018 +0300
@@ -172,6 +172,9 @@
 } DMC64EncDecOp;
 
 
+typedef DMC64EncDecOp DMC64EncDecOpList[D64_MAX_ENCDEC_OPS];
+
+
 typedef struct _DMC64ImageFormat
 {
     int  type;   // Type flags, see D64_FMT_*
@@ -196,7 +199,7 @@
 
     DMC64GetPixelFunc getPixel;
 
-    DMC64EncDecOp encdecOps[D64_MAX_ENCDEC_OPS];
+    const DMC64EncDecOpList encdecOps, *encdecOpsRef;
 } DMC64ImageFormat;
 
 
@@ -318,7 +321,8 @@
 
 static inline const DMC64EncDecOp * fmtGetEncDecOp(const DMC64ImageFormat *fmt, const int index)
 {
-    return &fmt->encdecOps[index];
+    // Ooh .. look at that beaauuuutiful deref ..
+    return fmt->encdecOpsRef != NULL ? &(* (fmt->encdecOpsRef))[index] : &fmt->encdecOps[index];
 }