From 1c51c48606930b3a784c0bbc99a5a8eb2188ca5f Mon Sep 17 00:00:00 2001 From: Soeren Sandmann Date: Wed, 18 Feb 2004 00:59:14 +0000 Subject: GC caching, bug #125645 (based on patch by Brian Cameron) Wed Feb 18 01:44:59 2004 Soeren Sandmann GC caching, bug #125645 (based on patch by Brian Cameron) * gdk/gdkscreen.h (struct _GdkScreen): Add GC cache * gdk/gdkscreen.c (gdk_screen_dispose): New function. Unref the cached GC's here. * gdk/gdkdraw.c (_gdk_drawable_get_scratch_gc): New function to get a scratch gc. * gdk/gdkinternals.h: Declare the function here * gdk/gdkdraw.c (gdk_drawable_real_draw_pixbuf): Use _gdk_drawable_get_scratch_gc() instead of creating a new GC. * gdk/x11/gdkgeometry-x11.c (gdk_window_copy_area_scroll): same * gdk/x11/gdkdrawable-x11.c (draw_with_images): same * gdk/gdkwindow.c (gdk_window_get_composite_drawable): same * gdk/gdkwindow.c (gdk_window_end_paint): same * gdk/gdkpixmap.c (gdk_pixmap_colormap_new_from_pixbuf): same * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_threshold_alpha): same * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_pixmap_and_mask_for_colormap): same --- gdk/gdkpixbuf-render.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'gdk/gdkpixbuf-render.c') diff --git a/gdk/gdkpixbuf-render.c b/gdk/gdkpixbuf-render.c index 8095188d9..b93fac33c 100644 --- a/gdk/gdkpixbuf-render.c +++ b/gdk/gdkpixbuf-render.c @@ -25,6 +25,7 @@ #include "gdk-pixbuf-private.h" #include "gdkpixbuf.h" #include "gdkscreen.h" +#include "gdkinternals.h" @@ -82,6 +83,7 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, return; gc = gdk_gc_new (bitmap); + gc = _gdk_drawable_get_scratch_gc (GDK_DRAWABLE (bitmap), FALSE); if (!pixbuf->has_alpha) { @@ -130,8 +132,6 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf, start + dest_x, y + dest_y, x - 1 + dest_x, y + dest_y); } - - g_object_unref (gc); } @@ -305,13 +305,12 @@ gdk_pixbuf_render_pixmap_and_mask_for_colormap (GdkPixbuf *pixbuf, gdk_colormap_get_visual (colormap)->depth); gdk_drawable_set_colormap (GDK_DRAWABLE (*pixmap_return), colormap); - gc = gdk_gc_new (*pixmap_return); + gc = _gdk_drawable_get_scratch_gc (*pixmap_return, FALSE); gdk_draw_pixbuf (*pixmap_return, gc, pixbuf, 0, 0, 0, 0, gdk_pixbuf_get_width (pixbuf), gdk_pixbuf_get_height (pixbuf), GDK_RGB_DITHER_NORMAL, 0, 0); - g_object_unref (gc); } if (mask_return) -- cgit v1.2.1