gdip-pixbuf-loader r5 - in trunk: . src
- From: doml svn gnome org
- To: svn-commits-list gnome org
- Subject: gdip-pixbuf-loader r5 - in trunk: . src
- Date: Mon, 18 Feb 2008 16:47:40 +0000 (GMT)
Author: doml
Date: Mon Feb 18 16:47:40 2008
New Revision: 5
URL: http://svn.gnome.org/viewvc/gdip-pixbuf-loader?rev=5&view=rev
Log:
2008-02-18 Dominic Lachowicz <domlachowicz gmail com>
* src/test.c: Dispose of the bitmap
* src/io-gdip-utils.[ch]: Add bitmap dispose function
Modified:
trunk/ChangeLog
trunk/src/io-gdip-native.h
trunk/src/io-gdip-utils.c
trunk/src/io-gdip-utils.h
trunk/src/test.c
Modified: trunk/src/io-gdip-native.h
==============================================================================
--- trunk/src/io-gdip-native.h (original)
+++ trunk/src/io-gdip-native.h Mon Feb 18 16:47:40 2008
@@ -116,7 +116,7 @@
};
typedef struct _GdiplusStartupInput GdiplusStartupInput;
-typedef Status (CALLBACK* GdiplusStartupFunc) (gpointer, const gpointer, gpointer );
+typedef Status (CALLBACK* GdiplusStartupFunc) (gpointer, const gpointer, gpointer);
typedef Status (CALLBACK* GdipCreateBitmapFromStreamFunc) (gpointer, GpBitmap**);
@@ -124,6 +124,6 @@
typedef Status (CALLBACK* GdipGetImageWidthFunc) (GpImage*, guint*);
typedef Status (CALLBACK* GdipGetImageHeightFunc) (GpImage*, guint*);
-
+typedef Status (CALLBACK* GdipDisposeImageFunc) (GpImage*);
#endif
Modified: trunk/src/io-gdip-utils.c
==============================================================================
--- trunk/src/io-gdip-utils.c (original)
+++ trunk/src/io-gdip-utils.c Mon Feb 18 16:47:40 2008
@@ -32,7 +32,6 @@
GpStatus WINGDIPAPI
GdiplusStartup (ULONG_PTR *token, const GdiplusStartupInput *input, gpointer *output)
{
-
GdiplusStartupFunc proc = NULL;
if (gdipluslib)
@@ -44,7 +43,6 @@
return (*proc) (token, (gpointer)input, output);
}
-
GpStatus WINGDIPAPI
GdipCreateBitmapFromStream (gpointer stream, GpBitmap** bitmap)
{
@@ -71,8 +69,6 @@
return GenericError;
return (*proc) (bitmap, x, y, color);
-
-
}
GpStatus WINGDIPAPI
@@ -90,6 +86,20 @@
}
GpStatus WINGDIPAPI
+GdipDisposeImage (GpImage* image)
+{
+ GdipDisposeImageFunc proc = NULL;
+
+ if (gdipluslib)
+ proc = (GdipDisposeImageFunc) GetProcAddress(gdipluslib, "GdipDisposeImage");
+
+ if (!proc)
+ return GenericError;
+
+ return (*proc) (image);
+}
+
+GpStatus WINGDIPAPI
GdipGetImageWidth (GpImage* image, guint* width)
{
GdipGetImageWidthFunc proc = NULL;
@@ -132,8 +142,8 @@
return TRUE;
}
-HGLOBAL
-io_gdip_buffer_to_hglobal (gchar * buffer, size_t size)
+static HGLOBAL
+io_gdip_buffer_to_hglobal (const gchar * buffer, size_t size)
{
HGLOBAL hg = NULL;
@@ -148,7 +158,7 @@
}
GpBitmap *
-io_gdip_buffer_to_bitmap (gchar * buffer, size_t size)
+io_gdip_buffer_to_bitmap (const gchar * buffer, size_t size)
{
HRESULT hr;
HGLOBAL hg = NULL;
@@ -200,4 +210,8 @@
return pixel;
}
-
+void
+io_gdip_dispose_bitmap (GpBitmap *bitmap)
+{
+ GdipDisposeImage ((GpImage*) bitmap);
+}
Modified: trunk/src/io-gdip-utils.h
==============================================================================
--- trunk/src/io-gdip-utils.h (original)
+++ trunk/src/io-gdip-utils.h Mon Feb 18 16:47:40 2008
@@ -27,7 +27,10 @@
gboolean io_gdip_init ();
GpBitmap *
-io_gdip_buffer_to_bitmap (gchar *, size_t);
+io_gdip_buffer_to_bitmap (const gchar *, size_t);
+
+void
+io_gdip_dispose_bitmap (GpBitmap *);
gboolean
io_gdip_bitmap_get_size (GpBitmap *, guint *, guint *);
Modified: trunk/src/test.c
==============================================================================
--- trunk/src/test.c (original)
+++ trunk/src/test.c Mon Feb 18 16:47:40 2008
@@ -88,13 +88,14 @@
if (!io_gdip_init ())
return 1;
- bitmap = io_gdip_buffer_to_bitmap ((gchar *)the_png, 351);
+ bitmap = io_gdip_buffer_to_bitmap (the_png, sizeof (the_png));
if (!bitmap) return 1;
_print_pixels (bitmap);
+
+ io_gdip_dispose_bitmap (bitmap);
- //Destroy bitmap
- //Shutdown
+ return 0;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]