gdip-pixbuf-loader r50 - trunk/src



Author: doml
Date: Tue Mar 18 14:03:59 2008
New Revision: 50
URL: http://svn.gnome.org/viewvc/gdip-pixbuf-loader?rev=50&view=rev

Log:
Fix up GetImageEncoders - PEBKAC

WMF pattern doesn't belong in the EMF plugin

Added:
   trunk/src/gdk-pixbuf-private.h
Modified:
   trunk/src/Makefile.am
   trunk/src/Makefile.test
   trunk/src/io-gdip-emf.c
   trunk/src/io-gdip-native.h
   trunk/src/io-gdip-utils.c
   trunk/src/io-gdip-utils.h
   trunk/src/io-gdip-wmf.c

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Tue Mar 18 14:03:59 2008
@@ -13,6 +13,7 @@
 libpixbufloader_gdip_ico_la_LDFLAGS = -avoid-version -module -no-undefined
 libpixbufloader_gdip_ico_la_SOURCES = 	\
 	io-gdip-native.h		\
+	gdk-pixbuf-private.h		\
 	io-gdip-propertytags.h		\
 	io-gdip-utils.h			\
 	io-gdip-utils.c			\
@@ -23,6 +24,7 @@
 libpixbufloader_gdip_wmf_la_LDFLAGS = -avoid-version -module -no-undefined
 libpixbufloader_gdip_wmf_la_SOURCES = 	\
 	io-gdip-native.h		\
+	gdk-pixbuf-private.h		\
 	io-gdip-propertytags.h		\
 	io-gdip-utils.h			\
 	io-gdip-utils.c			\
@@ -33,6 +35,7 @@
 libpixbufloader_gdip_emf_la_LDFLAGS = -avoid-version -module -no-undefined
 libpixbufloader_gdip_emf_la_SOURCES = 	\
 	io-gdip-native.h		\
+	gdk-pixbuf-private.h		\
 	io-gdip-propertytags.h		\
 	io-gdip-utils.h			\
 	io-gdip-utils.c			\
@@ -43,6 +46,7 @@
 libpixbufloader_gdip_bmp_la_LDFLAGS = -avoid-version -module -no-undefined
 libpixbufloader_gdip_bmp_la_SOURCES = 	\
 	io-gdip-native.h		\
+	gdk-pixbuf-private.h		\
 	io-gdip-propertytags.h		\
 	io-gdip-utils.h			\
 	io-gdip-utils.c			\
@@ -53,6 +57,7 @@
 libpixbufloader_gdip_gif_la_LDFLAGS = -avoid-version -module -no-undefined
 libpixbufloader_gdip_gif_la_SOURCES = 	\
 	io-gdip-native.h		\
+	gdk-pixbuf-private.h		\
 	io-gdip-propertytags.h		\
 	io-gdip-utils.h			\
 	io-gdip-utils.c			\
@@ -63,6 +68,7 @@
 libpixbufloader_gdip_jpeg_la_LDFLAGS = -avoid-version -module -no-undefined
 libpixbufloader_gdip_jpeg_la_SOURCES = 	\
 	io-gdip-native.h		\
+	gdk-pixbuf-private.h		\
 	io-gdip-propertytags.h		\
 	io-gdip-utils.h			\
 	io-gdip-utils.c			\
@@ -73,6 +79,7 @@
 libpixbufloader_gdip_png_la_LDFLAGS = -avoid-version -module -no-undefined
 libpixbufloader_gdip_png_la_SOURCES = 	\
 	io-gdip-native.h		\
+	gdk-pixbuf-private.h		\
 	io-gdip-propertytags.h		\
 	io-gdip-utils.h			\
 	io-gdip-utils.c			\
@@ -83,6 +90,7 @@
 libpixbufloader_gdip_tiff_la_LDFLAGS = -avoid-version -module -no-undefined
 libpixbufloader_gdip_tiff_la_SOURCES = 	\
 	io-gdip-native.h		\
+	gdk-pixbuf-private.h		\
 	io-gdip-propertytags.h		\
 	io-gdip-utils.h			\
 	io-gdip-utils.c			\

Modified: trunk/src/Makefile.test
==============================================================================
--- trunk/src/Makefile.test	(original)
+++ trunk/src/Makefile.test	Tue Mar 18 14:03:59 2008
@@ -1,5 +1,5 @@
 CC=gcc.exe
-CP=cp.exe
+CP=echo #cp.exe
 
 PREFIX=/c/Program\ Files/Common\ Files/GTK/2.0
 LOADER_DIR=$(PREFIX)/lib/gtk-2.0/2.10.0/loaders
@@ -17,34 +17,34 @@
 	$(CC) -Wall -O0 -g $(CFLAGS) $(LDFLAGS) test-save.c -o test-save.exe -lole32 -lglib-2.0 -lgobject-2.0 -lgdk_pixbuf-2.0
 	$(CP) test-save.exe $(PREFIX)/bin
 
-libpixbufloader-gdip-ico.dll: io-gdip-native.h  io-gdip-utils.c  io-gdip-utils.h  io-gdip-ico.c  io-gdip-animation.c  io-gdip-animation.h  Makefile.test
+libpixbufloader-gdip-ico.dll: gdk-pixbuf-private.h  io-gdip-native.h  io-gdip-utils.c  io-gdip-utils.h  io-gdip-ico.c  io-gdip-animation.c  io-gdip-animation.h  Makefile.test
 	$(CC) -Wall -O0 -g -shared io-gdip-utils.c io-gdip-ico.c io-gdip-animation.c $(CFLAGS) $(LDFLAGS) -lole32 -lglib-2.0 -lgobject-2.0 -lgdk_pixbuf-2.0 -o $@
 	$(CP) $@ $(LOADER_DIR)
 
-libpixbufloader-gdip-wmf.dll: io-gdip-native.h  io-gdip-utils.c  io-gdip-utils.h  io-gdip-wmf.c  io-gdip-animation.c  io-gdip-animation.h  Makefile.test
+libpixbufloader-gdip-wmf.dll: gdk-pixbuf-private.h  io-gdip-native.h  io-gdip-utils.c  io-gdip-utils.h  io-gdip-wmf.c  io-gdip-animation.c  io-gdip-animation.h  Makefile.test
 	$(CC) -Wall -O0 -g -shared io-gdip-utils.c io-gdip-wmf.c io-gdip-animation.c $(CFLAGS) $(LDFLAGS) -lole32 -lglib-2.0 -lgobject-2.0 -lgdk_pixbuf-2.0 -o $@
 	$(CP) $@ $(LOADER_DIR)
 
-libpixbufloader-gdip-emf.dll: io-gdip-native.h  io-gdip-utils.c  io-gdip-utils.h  io-gdip-emf.c  io-gdip-animation.c  io-gdip-animation.h  Makefile.test
+libpixbufloader-gdip-emf.dll: gdk-pixbuf-private.h  io-gdip-native.h  io-gdip-utils.c  io-gdip-utils.h  io-gdip-emf.c  io-gdip-animation.c  io-gdip-animation.h  Makefile.test
 	$(CC) -Wall -O0 -g -shared io-gdip-utils.c io-gdip-emf.c io-gdip-animation.c $(CFLAGS) $(LDFLAGS) -lole32 -lglib-2.0 -lgobject-2.0 -lgdk_pixbuf-2.0 -o $@
 	$(CP) $@ $(LOADER_DIR)
 
-libpixbufloader-gdip-bmp.dll: io-gdip-native.h  io-gdip-utils.c  io-gdip-utils.h  io-gdip-bmp.c  io-gdip-animation.c  io-gdip-animation.h  Makefile.test
+libpixbufloader-gdip-bmp.dll: gdk-pixbuf-private.h  io-gdip-native.h  io-gdip-utils.c  io-gdip-utils.h  io-gdip-bmp.c  io-gdip-animation.c  io-gdip-animation.h  Makefile.test
 	$(CC) -Wall -O0 -g -shared io-gdip-utils.c io-gdip-bmp.c io-gdip-animation.c $(CFLAGS) $(LDFLAGS) -lole32 -lglib-2.0 -lgobject-2.0 -lgdk_pixbuf-2.0 -o $@
 	$(CP) $@ $(LOADER_DIR)
 
-libpixbufloader-gdip-gif.dll: io-gdip-native.h  io-gdip-utils.c  io-gdip-utils.h  io-gdip-gif.c  io-gdip-animation.c  io-gdip-animation.h  Makefile.test
+libpixbufloader-gdip-gif.dll: gdk-pixbuf-private.h  io-gdip-native.h  io-gdip-utils.c  io-gdip-utils.h  io-gdip-gif.c  io-gdip-animation.c  io-gdip-animation.h  Makefile.test
 	$(CC) -Wall -O0 -g -shared io-gdip-utils.c io-gdip-gif.c io-gdip-animation.c $(CFLAGS) $(LDFLAGS) -lole32 -lglib-2.0 -lgobject-2.0 -lgdk_pixbuf-2.0 -o $@
 	$(CP) $@ $(LOADER_DIR)
 
-libpixbufloader-gdip-jpeg.dll: io-gdip-native.h  io-gdip-utils.c  io-gdip-utils.h  io-gdip-jpeg.c  io-gdip-animation.c  io-gdip-animation.h  Makefile.test
+libpixbufloader-gdip-jpeg.dll: gdk-pixbuf-private.h  io-gdip-native.h  io-gdip-utils.c  io-gdip-utils.h  io-gdip-jpeg.c  io-gdip-animation.c  io-gdip-animation.h  Makefile.test
 	$(CC) -Wall -O0 -g -shared io-gdip-utils.c io-gdip-jpeg.c io-gdip-animation.c $(CFLAGS) $(LDFLAGS) -lole32 -lglib-2.0 -lgobject-2.0 -lgdk_pixbuf-2.0 -o $@
 	$(CP) $@ $(LOADER_DIR)
 
-libpixbufloader-gdip-png.dll: io-gdip-native.h  io-gdip-utils.c  io-gdip-utils.h  io-gdip-png.c  io-gdip-animation.c  io-gdip-animation.h  Makefile.test
+libpixbufloader-gdip-png.dll: gdk-pixbuf-private.h  io-gdip-native.h  io-gdip-utils.c  io-gdip-utils.h  io-gdip-png.c  io-gdip-animation.c  io-gdip-animation.h  Makefile.test
 	$(CC) -Wall -O0 -g -shared io-gdip-utils.c io-gdip-png.c io-gdip-animation.c $(CFLAGS) $(LDFLAGS) -lole32 -lglib-2.0 -lgobject-2.0 -lgdk_pixbuf-2.0 -o $@
 	$(CP) $@ $(LOADER_DIR)
 
-libpixbufloader-gdip-tiff.dll: io-gdip-native.h  io-gdip-utils.c  io-gdip-utils.h  io-gdip-tiff.c  io-gdip-animation.c  io-gdip-animation.h  Makefile.test
+libpixbufloader-gdip-tiff.dll: gdk-pixbuf-private.h  io-gdip-native.h  io-gdip-utils.c  io-gdip-utils.h  io-gdip-tiff.c  io-gdip-animation.c  io-gdip-animation.h  Makefile.test
 	$(CC) -Wall -O0 -g -shared io-gdip-utils.c io-gdip-tiff.c io-gdip-animation.c $(CFLAGS) $(LDFLAGS) -lole32 -lglib-2.0 -lgobject-2.0 -lgdk_pixbuf-2.0 -o $@
 	$(CP) $@ $(LOADER_DIR)
\ No newline at end of file

Added: trunk/src/gdk-pixbuf-private.h
==============================================================================
--- (empty file)
+++ trunk/src/gdk-pixbuf-private.h	Tue Mar 18 14:03:59 2008
@@ -0,0 +1,8 @@
+#ifndef _GDIP_GDK_PIXBUF_PRIVATE_H_
+#define _GDIP_GDK_PIXBUF_PRIVATE_H_
+
+#ifndef _
+#define _(x) (x)
+#endif
+
+#endif

Modified: trunk/src/io-gdip-emf.c
==============================================================================
--- trunk/src/io-gdip-emf.c	(original)
+++ trunk/src/io-gdip-emf.c	Tue Mar 18 14:03:59 2008
@@ -33,7 +33,6 @@
 MODULE_ENTRY (emf, fill_info) (GdkPixbufFormat *info)
 {
   static GdkPixbufModulePattern signature[] = {
-    { "\x01\x00\x09\x00", NULL, 100 }, /* WMF */
     { "\x01\x00\x00\x00", NULL, 100 }, /* EMF */
     { NULL, NULL, 0 }
   };

Modified: trunk/src/io-gdip-native.h
==============================================================================
--- trunk/src/io-gdip-native.h	(original)
+++ trunk/src/io-gdip-native.h	Tue Mar 18 14:03:59 2008
@@ -218,8 +218,8 @@
 typedef GpStatus (WINGDIPAPI* GdipSaveImageToStreamFunc) (GpImage *image, IStream* stream, const CLSID* clsidEncoder, 
                                                           const EncoderParameters* encoderParams);
 
-typedef GpStatus (WINGDIAPI* GetImageEncodersFunc) (UINT numEncoders, UINT size, ImageCodecInfo *encoders);
-typedef GpStatus (WINGDIAPI* GetImageEncodersSizeFunc) (UINT *numEncoders, UINT *size);
+typedef GpStatus (WINGDIAPI* GdipGetImageEncodersFunc) (UINT numEncoders, UINT size, ImageCodecInfo *encoders);
+typedef GpStatus (WINGDIAPI* GdipGetImageEncodersSizeFunc) (UINT *numEncoders, UINT *size);
 typedef GpStatus (WINGDIPAPI* GdipBitmapSetPixelFunc) (GpBitmap* bitmap, INT x, INT y, ARGB color);
 
 typedef GpStatus (WINGDIPAPI* GdipDrawImageIFunc) (GpGraphics *graphics, GpImage *image, INT x, INT y);

Modified: trunk/src/io-gdip-utils.c
==============================================================================
--- trunk/src/io-gdip-utils.c	(original)
+++ trunk/src/io-gdip-utils.c	Tue Mar 18 14:03:59 2008
@@ -58,8 +58,8 @@
 static GdipDeleteGraphicsFunc GdipDeleteGraphics;
 
 /* apparently these don't exist until GDI+ 1.1 or later */
-static GetImageEncodersFunc GetImageEncoders;
-static GetImageEncodersSizeFunc GetImageEncodersSize;
+static GdipGetImageEncodersFunc GdipGetImageEncoders;
+static GdipGetImageEncodersSizeFunc GdipGetImageEncodersSize;
 
 DEFINE_GUID(FrameDimensionTime, 0x6aedbd6d,0x3fb5,0x418a,0x83,0xa6,0x7f,0x45,0x22,0x9d,0xc8,0x72);
 DEFINE_GUID(FrameDimensionPage, 0x7462dc86,0x6180,0x4c7e,0x8e,0x3f,0xee,0x73,0x33,0xa7,0xa4,0x83);
@@ -173,16 +173,11 @@
   G_STMT_START { \
     func = (func##Func) GetProcAddress (gdipluslib, #func); \
     if (!func) {\
-      /* g_warning ("Couldn't load function: %s\n", #func); */ \
+      g_warning ("Couldn't load GDI+ function: %s\n", #func); \
       return FALSE; \
     } \
   } G_STMT_END
 
-#define TRY_LOOKUP(func) \
-  G_STMT_START { \
-    func = (func##Func) GetProcAddress (gdipluslib, #func); \
-  } G_STMT_END
-
   LOOKUP (GdiplusStartup);
   LOOKUP (GdipCreateBitmapFromStream);
   LOOKUP (GdipBitmapGetPixel);
@@ -208,11 +203,9 @@
   LOOKUP (GdipGetImageVerticalResolution);
   LOOKUP (GdipLoadImageFromStream);
   LOOKUP (GdipDeleteGraphics);
+  LOOKUP (GdipGetImageEncoders);
+  LOOKUP (GdipGetImageEncodersSize);
 
-  TRY_LOOKUP (GetImageEncoders);
-  TRY_LOOKUP (GetImageEncodersSize);
-
-#undef TRY_LOOKUP
 #undef LOOKUP
 
   input.GdiplusVersion = 1;
@@ -225,14 +218,14 @@
 static int 
 GetEncoderClsid (const WCHAR *format, CLSID *pClsid)
 {
-  if (GetImageEncodersSize && GetImageEncoders) {
+  if (GdipGetImageEncodersSize && GdipGetImageEncoders) {
     UINT num = 0;
     UINT size = 0;
     UINT j;
     
     ImageCodecInfo *pImageCodecInfo = NULL;
     
-    GetImageEncodersSize (&num, &size);
+    GdipGetImageEncodersSize (&num, &size);
     if(size == 0)
       return -1;
     
@@ -240,7 +233,7 @@
     if(pImageCodecInfo == NULL)
       return -1;
     
-    GetImageEncoders (num, size, pImageCodecInfo);
+    GdipGetImageEncoders (num, size, pImageCodecInfo);
     
     for (j = 0; j < num; ++j) {
       if(wcscmp(pImageCodecInfo[j].MimeType, format) == 0) {

Modified: trunk/src/io-gdip-utils.h
==============================================================================
--- trunk/src/io-gdip-utils.h	(original)
+++ trunk/src/io-gdip-utils.h	Tue Mar 18 14:03:59 2008
@@ -27,11 +27,7 @@
 #define GDK_PIXBUF_ENABLE_BACKEND
 #include <gdk-pixbuf/gdk-pixbuf-io.h>
 #include <gdk-pixbuf/gdk-pixbuf.h>
-/* #include <glib/gi18n-lib.h> */
-
-#ifndef _
-#define _(x) (x)
-#endif
+#include "gdk-pixbuf-private.h"
 
 #include "io-gdip-native.h"
 

Modified: trunk/src/io-gdip-wmf.c
==============================================================================
--- trunk/src/io-gdip-wmf.c	(original)
+++ trunk/src/io-gdip-wmf.c	Tue Mar 18 14:03:59 2008
@@ -34,6 +34,7 @@
 {
   static GdkPixbufModulePattern signature[] = {
     { "\xd7\xcd\xc6\x9a", NULL, 100 }, /* WMF */
+    { "\x01\x00\x09\x00", NULL, 100 }, /* WMF */
     { NULL, NULL, 0 }
   };
 



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