+Wed Feb 18 17:53:27 2004 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ * gdk/gdkwindow.c (gdk_window_get_bg_gc): Use a scratch GC in the
+ case where the background is a solid color.
+ (gdk_window_clear_backing_rect): Reset the clip region after use.
+
+ * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_threshold_alpha): Go
+ back to using a scratch GC. Pointed out by Owen Taylor
+
+ * gdk/gdkdraw.c (gdk_drawable_real_draw_pixbuf): Only use a
+ scratch GC if the passed-in one is NULL
+
Wed Feb 18 14:27:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gdk/gdkwindow.c (gdk_window_get_composite_drawable): Reset clip
+Wed Feb 18 17:53:27 2004 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ * gdk/gdkwindow.c (gdk_window_get_bg_gc): Use a scratch GC in the
+ case where the background is a solid color.
+ (gdk_window_clear_backing_rect): Reset the clip region after use.
+
+ * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_threshold_alpha): Go
+ back to using a scratch GC. Pointed out by Owen Taylor
+
+ * gdk/gdkdraw.c (gdk_drawable_real_draw_pixbuf): Only use a
+ scratch GC if the passed-in one is NULL
+
Wed Feb 18 14:27:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gdk/gdkwindow.c (gdk_window_get_composite_drawable): Reset clip
+Wed Feb 18 17:53:27 2004 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ * gdk/gdkwindow.c (gdk_window_get_bg_gc): Use a scratch GC in the
+ case where the background is a solid color.
+ (gdk_window_clear_backing_rect): Reset the clip region after use.
+
+ * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_threshold_alpha): Go
+ back to using a scratch GC. Pointed out by Owen Taylor
+
+ * gdk/gdkdraw.c (gdk_drawable_real_draw_pixbuf): Only use a
+ scratch GC if the passed-in one is NULL
+
Wed Feb 18 14:27:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gdk/gdkwindow.c (gdk_window_get_composite_drawable): Reset clip
+Wed Feb 18 17:53:27 2004 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ * gdk/gdkwindow.c (gdk_window_get_bg_gc): Use a scratch GC in the
+ case where the background is a solid color.
+ (gdk_window_clear_backing_rect): Reset the clip region after use.
+
+ * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_threshold_alpha): Go
+ back to using a scratch GC. Pointed out by Owen Taylor
+
+ * gdk/gdkdraw.c (gdk_drawable_real_draw_pixbuf): Only use a
+ scratch GC if the passed-in one is NULL
+
Wed Feb 18 14:27:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gdk/gdkwindow.c (gdk_window_get_composite_drawable): Reset clip
+Wed Feb 18 17:53:27 2004 Soeren Sandmann <sandmann@daimi.au.dk>
+
+ * gdk/gdkwindow.c (gdk_window_get_bg_gc): Use a scratch GC in the
+ case where the background is a solid color.
+ (gdk_window_clear_backing_rect): Reset the clip region after use.
+
+ * gdk/gdkpixbuf-render.c (gdk_pixbuf_render_threshold_alpha): Go
+ back to using a scratch GC. Pointed out by Owen Taylor
+
+ * gdk/gdkdraw.c (gdk_drawable_real_draw_pixbuf): Only use a
+ scratch GC if the passed-in one is NULL
+
Wed Feb 18 14:27:08 2004 Soeren Sandmann <sandmann@daimi.au.dk>
* gdk/gdkwindow.c (gdk_window_get_composite_drawable): Reset clip
return;
/* Actually draw */
- gc = _gdk_drawable_get_scratch_gc (drawable, FALSE);
+ if (!gc)
+ gc = _gdk_drawable_get_scratch_gc (drawable, FALSE);
if (pixbuf->has_alpha)
{
* the standard values for @drawable, except for the graphics_exposures
* field which is determined by the @graphics_exposures parameter.
*
- * The returned #GdkGC must not be altered in any way and must not
- * be freed.
+ * The foreground color of the returned #GdkGC is undefined. The #GdkGC
+ * must not be altered in any way, except to change its foreground color.
*
* Return value: A #GdkGC suitable for drawing on @drawable
*
g_return_val_if_fail (!screen->closed, NULL);
depth = gdk_drawable_get_depth (drawable);
-
+
if (graphics_exposures)
{
if (!screen->exposure_gcs[depth])
if (width == 0 || height == 0)
return;
- gc = gdk_gc_new (bitmap);
+ gc = _gdk_drawable_get_scratch_gc (bitmap, FALSE);
if (!pixbuf->has_alpha)
{
color.pixel = (alpha_threshold == 255) ? 0 : 1;
gdk_gc_set_foreground (gc, &color);
gdk_draw_rectangle (bitmap, gc, TRUE, dest_x, dest_y, width, height);
- g_object_unref (gc);
return;
}
start + dest_x, y + dest_y,
x - 1 + dest_x, y + dest_y);
}
-
- g_object_unref (gc);
}
\f
gdk_region_destroy (region);
}
-static GdkGC *
-gdk_window_get_bg_gc (GdkWindow *window,
- GdkWindowPaint *paint)
-{
- GdkWindowObject *private = (GdkWindowObject *)window;
-
- guint gc_mask = 0;
- GdkGCValues gc_values;
-
- if (private->bg_pixmap == GDK_PARENT_RELATIVE_BG && private->parent)
- {
- GdkWindowPaint tmp_paint = *paint;
- tmp_paint.x_offset += private->x;
- tmp_paint.y_offset += private->y;
-
- return gdk_window_get_bg_gc (GDK_WINDOW (private->parent), &tmp_paint);
- }
- else if (private->bg_pixmap &&
- private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
- private->bg_pixmap != GDK_NO_BG)
- {
- gc_values.fill = GDK_TILED;
- gc_values.tile = private->bg_pixmap;
-
- gc_mask = GDK_GC_FILL | GDK_GC_TILE;
- }
- else
- {
- gc_values.foreground = private->bg_color;
- gc_mask = GDK_GC_FOREGROUND;
- }
-
- return gdk_gc_new_with_values (paint->pixmap, &gc_values, gc_mask);
-}
-
#ifdef GDK_WINDOWING_X11
#include "x11/gdkx.h"
#endif
RESTORE_GC (gc);
}
+static GdkGC *
+gdk_window_get_bg_gc (GdkWindow *window,
+ GdkWindowPaint *paint)
+{
+ GdkWindowObject *private = (GdkWindowObject *)window;
+
+ guint gc_mask = 0;
+ GdkGCValues gc_values;
+
+ if (private->bg_pixmap == GDK_PARENT_RELATIVE_BG && private->parent)
+ {
+ GdkWindowPaint tmp_paint = *paint;
+ tmp_paint.x_offset += private->x;
+ tmp_paint.y_offset += private->y;
+
+ return gdk_window_get_bg_gc (GDK_WINDOW (private->parent), &tmp_paint);
+ }
+ else if (private->bg_pixmap &&
+ private->bg_pixmap != GDK_PARENT_RELATIVE_BG &&
+ private->bg_pixmap != GDK_NO_BG)
+ {
+ gc_values.fill = GDK_TILED;
+ gc_values.tile = private->bg_pixmap;
+
+ gc_mask = GDK_GC_FILL | GDK_GC_TILE;
+
+ return gdk_gc_new_with_values (paint->pixmap, &gc_values, gc_mask);
+ }
+ else
+ {
+ GdkGC *gc = _gdk_drawable_get_scratch_gc (paint->pixmap, FALSE);
+
+ gdk_gc_set_foreground (gc, &(private->bg_color));
+
+ return g_object_ref (gc);
+ }
+}
+
static void
gdk_window_clear_backing_rect (GdkWindow *window,
gint x,
gdk_draw_rectangle (window, tmp_gc, TRUE,
x, y, width, height);
+ gdk_gc_set_clip_region (tmp_gc, NULL);
+
g_object_unref (tmp_gc);
}