diff options
author | Federico Mena Quintero <federico@nuclecu.unam.mx> | 1999-03-10 01:14:38 +0000 |
---|---|---|
committer | Tim Janik <timj@src.gnome.org> | 1999-03-10 01:14:38 +0000 |
commit | 5db63aaa6d002ca7d174a3516b3cac7d30281589 (patch) | |
tree | 728f695420fb0388092cc362d723582cbfd7957c /gtk | |
parent | 7e8d27f32774fec30e7fadda7d1f5172f48c8395 (diff) | |
download | gdk-pixbuf-5db63aaa6d002ca7d174a3516b3cac7d30281589.tar.gz |
Significantly reduced the number of calls to gdk_draw_point() (and thus to
Wed Mar 10 02:07:31 1999 Tim Janik <timj@gtk.org>
* merged from 1.3:
1999-03-09 Federico Mena Quintero <federico@nuclecu.unam.mx>
* gtk/gtkstyle.c (gtk_default_draw_handle): Significantly reduced
the number of calls to gdk_draw_point() (and thus to X) by
clipping the points by hand.
* gtk/gtkhandlebox.c (draw_textured_frame): Actually make use of
the clip parameter.
(gtk_handle_box_paint): Only paint the handle if the expose area
intersects it.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkhandlebox.c | 8 | ||||
-rw-r--r-- | gtk/gtkstyle.c | 48 |
2 files changed, 38 insertions, 18 deletions
diff --git a/gtk/gtkhandlebox.c b/gtk/gtkhandlebox.c index c64a94f8a..30783ad60 100644 --- a/gtk/gtkhandlebox.c +++ b/gtk/gtkhandlebox.c @@ -690,7 +690,7 @@ draw_textured_frame (GtkWidget *widget, GdkWindow *window, GdkRectangle *rect, G GdkRectangle *clip) { gtk_paint_handle(widget->style, window, GTK_STATE_NORMAL, shadow, - NULL, widget, "handlebox", + clip, widget, "handlebox", rect->x, rect->y, rect->width, rect->height, GTK_ORIENTATION_VERTICAL); } @@ -740,6 +740,7 @@ gtk_handle_box_paint (GtkWidget *widget, guint width; guint height; GdkRectangle rect; + GdkRectangle dest; bin = GTK_BIN (widget); hb = GTK_HANDLE_BOX (widget); @@ -797,7 +798,10 @@ gtk_handle_box_paint (GtkWidget *widget, break; } - draw_textured_frame (widget, hb->bin_window, &rect, GTK_SHADOW_OUT, event ? &event->area : area); + if (gdk_rectangle_intersect (event ? &event->area : area, &rect, &dest)) + draw_textured_frame (widget, hb->bin_window, &rect, + GTK_SHADOW_OUT, + event ? &event->area : area); if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) { diff --git a/gtk/gtkstyle.c b/gtk/gtkstyle.c index 2c8d8e1fb..30a60363f 100644 --- a/gtk/gtkstyle.c +++ b/gtk/gtkstyle.c @@ -3055,7 +3055,9 @@ gtk_default_draw_handle (GtkStyle *style, gint xx, yy; gint xthick, ythick; GdkGC *light_gc, *dark_gc; + GdkRectangle rect; GdkRectangle dest; + gint intersect; g_return_if_fail (style != NULL); g_return_if_fail (window != NULL); @@ -3076,26 +3078,40 @@ gtk_default_draw_handle (GtkStyle *style, xthick = style->klass->xthickness; ythick = style->klass->ythickness; - dest.x = x + xthick; - dest.y = y + ythick; - dest.width = width - (xthick * 2); - dest.height = height - (ythick * 2); - - gdk_gc_set_clip_rectangle (light_gc, &dest); - gdk_gc_set_clip_rectangle (dark_gc, &dest); - + rect.x = x + xthick; + rect.y = y + ythick; + rect.width = width - (xthick * 2); + rect.height = height - (ythick * 2); + + if (area) + intersect = gdk_rectangle_intersect (area, &rect, &dest); + else + { + intersect = TRUE; + dest = rect; + } + + if (!intersect) + return; + +#define DRAW_POINT(w, gc, clip, xx, yy) \ + { \ + if ((xx) >= (clip).x \ + && (yy) >= (clip).y \ + && (xx) < (clip).x + (clip).width \ + && (yy) < (clip).y + (clip).height) \ + gdk_draw_point ((w), (gc), (xx), (yy)); \ + } + for (yy = y + ythick; yy < (y + height - ythick); yy += 3) for (xx = x + xthick; xx < (x + width - xthick); xx += 6) { - gdk_draw_point (window, light_gc, xx, yy); - gdk_draw_point (window, dark_gc, xx + 1, yy + 1); - - gdk_draw_point (window, light_gc, xx + 3, yy + 1); - gdk_draw_point (window, dark_gc, xx + 4, yy + 2); + DRAW_POINT (window, light_gc, dest, xx, yy); + DRAW_POINT (window, dark_gc, dest, xx + 1, yy + 1); + + DRAW_POINT (window, light_gc, dest, xx + 3, yy + 1); + DRAW_POINT (window, dark_gc, dest, xx + 4, yy + 2); } - - gdk_gc_set_clip_rectangle (light_gc, NULL); - gdk_gc_set_clip_rectangle (dark_gc, NULL); } static void |