diff tools/gfxconv.c @ 931:2270d7f3af77

Refactor the DMC64Image handling to be more dynamic, and start work on allowing non 320/160 x 200 formats, and charmode based formats. There is still work to be done, and some problems to sort out.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 25 Feb 2015 19:37:59 +0200
parents 602b4aa34293
children 8fe48c08dbca
line wrap: on
line diff
--- a/tools/gfxconv.c	Wed Feb 25 19:32:55 2015 +0200
+++ b/tools/gfxconv.c	Wed Feb 25 19:37:59 2015 +0200
@@ -1556,7 +1556,7 @@
 {
     FILE *inFile;
     const DMC64ImageFormat *cfmt;
-    DMC64Image cimage;
+    DMC64Image *cimage = NULL;
     Uint8 *dataBuf = NULL;
     size_t dataSize;
     int i;
@@ -1709,7 +1709,7 @@
                 switch (optOutFormat)
                 {
                     case FFMT_IMAGE:
-                        res = dmC64ConvertBMP2Image(&outImage, &cimage, cfmt, FALSE);
+                        res = dmC64ConvertBMP2Image(&outImage, cimage, cfmt, FALSE);
 
                         if (res != DMERR_OK || outImage == NULL)
                         {
@@ -1722,12 +1722,12 @@
 
 
                     case FFMT_BITMAP:
-                        res = dmWriteBitmap(optOutFilename, &cimage, optOutSubFormat, TRUE);
+                        res = dmWriteBitmap(optOutFilename, cimage, optOutSubFormat, TRUE);
                         break;
 
                     case FFMT_CHAR:
                     case FFMT_SPRITE:
-                        res = dmC64ConvertBMP2Image(&outImage, &cimage, cfmt, TRUE);
+                        res = dmC64ConvertBMP2Image(&outImage, cimage, cfmt, TRUE);
 
                         if (res != DMERR_OK || outImage == NULL)
                         {
@@ -1803,6 +1803,7 @@
 
 error:
     dmFree(dataBuf);
+    dmFree(cimage);
     return -3;
     exit(3);
 }