mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-05 16:20:10 +00:00
Use a scratch GC in the case where the background is a solid color.
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
This commit is contained in:
parent
f539d99334
commit
b69a67119c
12
ChangeLog
12
ChangeLog
@ -1,3 +1,15 @@
|
||||
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
|
||||
|
@ -1,3 +1,15 @@
|
||||
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
|
||||
|
@ -1,3 +1,15 @@
|
||||
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
|
||||
|
@ -1,3 +1,15 @@
|
||||
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
|
||||
|
@ -1,3 +1,15 @@
|
||||
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
|
||||
|
@ -1404,7 +1404,8 @@ gdk_drawable_real_draw_pixbuf (GdkDrawable *drawable,
|
||||
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)
|
||||
{
|
||||
@ -1540,8 +1541,8 @@ gdk_drawable_real_draw_pixbuf (GdkDrawable *drawable,
|
||||
* 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
|
||||
*
|
||||
@ -1561,7 +1562,7 @@ _gdk_drawable_get_scratch_gc (GdkDrawable *drawable,
|
||||
g_return_val_if_fail (!screen->closed, NULL);
|
||||
|
||||
depth = gdk_drawable_get_depth (drawable);
|
||||
|
||||
|
||||
if (graphics_exposures)
|
||||
{
|
||||
if (!screen->exposure_gcs[depth])
|
||||
|
@ -82,14 +82,13 @@ gdk_pixbuf_render_threshold_alpha (GdkPixbuf *pixbuf,
|
||||
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;
|
||||
}
|
||||
|
||||
@ -131,8 +130,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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -851,41 +851,6 @@ gdk_window_begin_paint_rect (GdkWindow *window,
|
||||
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
|
||||
@ -1663,6 +1628,44 @@ gdk_window_draw_glyphs (GdkDrawable *drawable,
|
||||
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,
|
||||
@ -1683,6 +1686,8 @@ gdk_window_clear_backing_rect (GdkWindow *window,
|
||||
gdk_draw_rectangle (window, tmp_gc, TRUE,
|
||||
x, y, width, height);
|
||||
|
||||
gdk_gc_set_clip_region (tmp_gc, NULL);
|
||||
|
||||
g_object_unref (tmp_gc);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user