changeset 441:2a4de5fe4003

Improve loading of input images to use the list provided by libgfx.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 04 Nov 2012 06:40:35 +0200
parents b4ed5292d7bf
children a67600e186d0
files gfxconv.c
diffstat 1 files changed, 6 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/gfxconv.c	Sun Nov 04 03:32:00 2012 +0200
+++ b/gfxconv.c	Sun Nov 04 06:40:35 2012 +0200
@@ -926,7 +926,7 @@
 
         case FFMT_IMAGE:
             {
-                DMImage *outImage;
+                DMImage *outImage = NULL;
                 int res = DMERR_OK;
 
                 if (optOutFilename == NULL)
@@ -936,16 +936,11 @@
                 }
 
                 // Read input
-                switch (optInSubFormat)
-                {
-                    case IMGFMT_PCX: res = dmReadPCXImageFILE(inFile, &outImage); break;
-//                    case IMGFMT_PNG: res = dmReadPNGImageFILE(inFile, &outImage); break;
-//                    case IMGFMT_ARAW: res = dmReadARAWImageFILE(inFile, &outImage, optSpec.nplanes); break;
-                    default:
-                        dmError("Unsupported input image format for bitmap/image conversion.\n");
-                        break;
-                    
-                }
+                DMImageFormat *ifmt = &dmImageFormatList[optInSubFormat];
+                if (ifmt->readFILE != NULL)
+                    res = ifmt->readFILE(inFile, &outImage);
+                else
+                    dmError("Unsupported input image format for bitmap/image conversion.\n");
 
                 if (res != DMERR_OK || outImage == NULL)
                     break;