gdip-pixbuf-loader r30 - in trunk: . src



Author: doml
Date: Fri Feb 22 17:56:03 2008
New Revision: 30
URL: http://svn.gnome.org/viewvc/gdip-pixbuf-loader?rev=30&view=rev

Log:
2008-02-22  Dom Lachowicz <domlachowicz gmail com>

	* src/io-gdip-utils.c (GetEncoderClsid): Add support for BMP, JPEG, GIF, and TIFF

Modified:
   trunk/ChangeLog
   trunk/src/io-gdip-utils.c

Modified: trunk/src/io-gdip-utils.c
==============================================================================
--- trunk/src/io-gdip-utils.c	(original)
+++ trunk/src/io-gdip-utils.c	Fri Feb 22 17:56:03 2008
@@ -149,22 +149,30 @@
     }
   else
     {
-      static CLSID gdip_png_guid = { 0x557cf406, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } };
+      size_t i;
 
-      if (wcscmp(format, L"image/png") == 0)
+      /* encoder formats supported by GDI+ out of the box */
+      struct
+      {
+        const WCHAR* format;
+        CLSID clsid;
+      } format_and_clsid[] = {
+        { L"image/bmp",  { 0x557cf400, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } } },
+        { L"image/gif",  { 0x557cf402, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } } },
+        { L"image/jpeg", { 0x557cf401, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } } },
+        { L"image/png",  { 0x557cf406, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } } },
+        { L"image/tiff", { 0x557cf405, 0x1a04, 0x11d3, { 0x9a, 0x73, 0x0, 0x0, 0xf8, 0x1e, 0xf3, 0x2e } } }
+      };
+
+      for (i = 0; i < G_N_ELEMENTS(format_and_clsid); i++)
         {
-          *pClsid = gdip_png_guid;
-          return 0;
+          if (wcscmp(format, format_and_clsid[i].format) == 0)
+            {
+              *pClsid = format_and_clsid[i].clsid;
+              return i;
+            }
         }
 
-      /*
-        todo:
-        image/bmp
-        image/jpeg
-        image/gif
-        image/tiff
-      */
-
       return -1;
     }
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]