Author: jordi
Date: 2005-09-07 08:17:38 -0400 (Wed, 07 Sep 2005)
New Revision: 49629
Modified:
trunk/libgdiplus/src/ChangeLog
trunk/libgdiplus/src/graphics.c
trunk/libgdiplus/src/image.c
Log:
2005-09-07 Jordi Mas i Hernandez <[EMAIL PROTECTED]>
* graphics.c: fixes cairo handles leaks
* image.c: optimise and fix leaks
Modified: trunk/libgdiplus/src/ChangeLog
===================================================================
--- trunk/libgdiplus/src/ChangeLog 2005-09-07 10:51:13 UTC (rev 49628)
+++ trunk/libgdiplus/src/ChangeLog 2005-09-07 12:17:38 UTC (rev 49629)
@@ -1,3 +1,8 @@
+2005-09-07 Jordi Mas i Hernandez <[EMAIL PROTECTED]>
+
+ * graphics.c: fixes cairo handles leaks
+ * image.c: optimise and fix leaks
+
2005-09-06 Jordi Mas i Hernandez <[EMAIL PROTECTED]>
* graphics.c: Makes DrawString clipping not destroy previous clipping
Modified: trunk/libgdiplus/src/graphics.c
===================================================================
--- trunk/libgdiplus/src/graphics.c 2005-09-07 10:51:13 UTC (rev 49628)
+++ trunk/libgdiplus/src/graphics.c 2005-09-07 12:17:38 UTC (rev 49629)
@@ -92,13 +92,10 @@
image->image.surface = surface;
cairo_pattern_set_filter (cairo_pattern_create_for_surface
(image->image.surface), gdip_get_cairo_filter (graphics->interpolation));
- graphics->ct = cairo_create (surface);
+ if (graphics->ct)
+ cairo_destroy (graphics->ct);
- /* Increase the reference count of the surface. Because, this surface
- * is referenced by graphics->ct also. This is required for the proper
- * memory management of the surface.
- */
- cairo_surface_reference (image->image.surface);
+ graphics->ct = cairo_create (surface);
graphics->image = image;
graphics->type = gtMemoryBitmap;
}
@@ -373,6 +370,7 @@
*graphics = gdip_graphics_new(surface);
+ cairo_surface_destroy (surface);
(*graphics)->type = gtX11Drawable;
(*graphics)->display = dpy;
Modified: trunk/libgdiplus/src/image.c
===================================================================
--- trunk/libgdiplus/src/image.c 2005-09-07 10:51:13 UTC (rev 49628)
+++ trunk/libgdiplus/src/image.c 2005-09-07 12:17:38 UTC (rev 49629)
@@ -130,21 +130,13 @@
if (!image || !graphics)
return InvalidParameter;
+
+ if (image->type != imageBitmap)
+ return NotImplemented;
- /* we need to look into this */
- surface = cairo_image_surface_create(image->format,
- image->width, image->height);
-
- gfx = gdip_graphics_new (surface);
-
- if (image->type == imageBitmap) {
- gdip_graphics_attach_bitmap (gfx, (GpBitmap *) image);
- }
- else if (image->type == imageMetafile) {
- }
-
+ gfx = gdip_graphics_new (NULL);
+ gdip_graphics_attach_bitmap (gfx, (GpBitmap *) image);
*graphics = gfx;
-
return Ok;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches