summaryrefslogtreecommitdiff
path: root/gdk/gdkscreen.c
diff options
context:
space:
mode:
authorSoeren Sandmann <sandmann@daimi.au.dk>2004-02-18 00:59:14 +0000
committerSøren Sandmann Pedersen <ssp@src.gnome.org>2004-02-18 00:59:14 +0000
commit1c51c48606930b3a784c0bbc99a5a8eb2188ca5f (patch)
treea8ae2772d178953d6f9c2cd996eaa1f1a63f87f2 /gdk/gdkscreen.c
parentb3013744c5fb3deb8d2e292f300fc54fc710dc85 (diff)
downloadgtk+-1c51c48606930b3a784c0bbc99a5a8eb2188ca5f.tar.gz
GC caching, bug #125645 (based on patch by Brian Cameron)
Wed Feb 18 01:44:59 2004 Soeren Sandmann <sandmann@daimi.au.dk> 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
Diffstat (limited to 'gdk/gdkscreen.c')
-rw-r--r--gdk/gdkscreen.c30
1 files changed, 28 insertions, 2 deletions
diff --git a/gdk/gdkscreen.c b/gdk/gdkscreen.c
index 0492ab2095..329eab9540 100644
--- a/gdk/gdkscreen.c
+++ b/gdk/gdkscreen.c
@@ -23,11 +23,11 @@
#include "gdk.h" /* For gdk_rectangle_intersect() */
#include "gdkcolor.h"
-#include "gdkinternals.h"
#include "gdkwindow.h"
#include "gdkscreen.h"
-static void gdk_screen_class_init (GdkScreenClass *klass);
+static void gdk_screen_class_init (GdkScreenClass *klass);
+static void gdk_screen_dispose (GObject *object);
enum
{
@@ -37,6 +37,8 @@ enum
static guint signals[LAST_SIGNAL] = { 0 };
+static gpointer parent_class = NULL;
+
GType
gdk_screen_get_type (void)
{
@@ -67,6 +69,12 @@ gdk_screen_get_type (void)
static void
gdk_screen_class_init (GdkScreenClass *klass)
{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ parent_class = g_type_class_peek_parent (klass);
+
+ object_class->dispose = gdk_screen_dispose;
+
/**
* GdkScreen::size-changed:
* @screen: the object on which the signal is emitted
@@ -87,6 +95,24 @@ gdk_screen_class_init (GdkScreenClass *klass)
0);
}
+static void
+gdk_screen_dispose (GObject *object)
+{
+ GdkScreen *screen = GDK_SCREEN (object);
+ gint i;
+
+ for (i = 0; i < 32; ++i)
+ {
+ if (screen->exposure_gcs[i])
+ g_object_unref (screen->exposure_gcs[i]);
+
+ if (screen->normal_gcs[i])
+ g_object_unref (screen->normal_gcs[i]);
+ }
+
+ G_OBJECT_CLASS (parent_class)->dispose (object);
+}
+
void
_gdk_screen_close (GdkScreen *screen)
{