[gtk+/client-side-windows: 181/284] Call _gdk_window_process_updates_recurse() in drawRect instead of creating our own expose events
- From: Alexander Larsson <alexl src gnome org>
- To: svn-commits-list gnome org
- Subject: [gtk+/client-side-windows: 181/284] Call _gdk_window_process_updates_recurse() in drawRect instead of creating our own expose events
- Date: Thu, 2 Apr 2009 14:14:56 -0400 (EDT)
commit 65b5644cda073928f6f9005db3e4bb27c589c165
Author: Richard Hult <richard imendio com>
Date: Mon Jan 26 20:29:51 2009 +0100
Call _gdk_window_process_updates_recurse() in drawRect instead of creating our own expose events
---
gdk/quartz/GdkQuartzView.c | 49 +++++++++++++++++++------------------------
1 files changed, 22 insertions(+), 27 deletions(-)
diff --git a/gdk/quartz/GdkQuartzView.c b/gdk/quartz/GdkQuartzView.c
index 619f0f6..1d0f4eb 100644
--- a/gdk/quartz/GdkQuartzView.c
+++ b/gdk/quartz/GdkQuartzView.c
@@ -69,43 +69,38 @@
[self getRectsBeingDrawn:&drawn_rects count:&count];
- region = gdk_region_new ();
-
- for (i = 0; i < count; i++)
- {
- gdk_rect.x = drawn_rects[i].origin.x;
- gdk_rect.y = drawn_rects[i].origin.y;
- gdk_rect.width = drawn_rects[i].size.width;
- gdk_rect.height = drawn_rects[i].size.height;
-
- gdk_region_union_with_rect (region, &gdk_rect);
- }
-
- if (!gdk_region_empty (region))
+ /* Note: arbitrary limit here to not degrade performace too much. It would
+ * be better to optimize the construction of the region below, by using
+ * _gdk_region_new_from_yxbanded_rects.
+ */
+ if (count > 25)
{
- GdkEvent event;
-
gdk_rect.x = rect.origin.x;
gdk_rect.y = rect.origin.y;
gdk_rect.width = rect.size.width;
gdk_rect.height = rect.size.height;
-
- event.expose.type = GDK_EXPOSE;
- event.expose.window = g_object_ref (gdk_window);
- event.expose.send_event = FALSE;
- event.expose.count = 0;
- event.expose.region = region;
- event.expose.area = gdk_rect;
-
- impl->in_paint_rect_count++;
- (*_gdk_event_func) (&event, _gdk_event_data);
+ region = gdk_region_rectangle (&gdk_rect);
+ }
+ else
+ {
+ region = gdk_region_new ();
- impl->in_paint_rect_count--;
+ for (i = 0; i < count; i++)
+ {
+ gdk_rect.x = drawn_rects[i].origin.x;
+ gdk_rect.y = drawn_rects[i].origin.y;
+ gdk_rect.width = drawn_rects[i].size.width;
+ gdk_rect.height = drawn_rects[i].size.height;
- g_object_unref (gdk_window);
+ gdk_region_union_with_rect (region, &gdk_rect);
+ }
}
+ impl->in_paint_rect_count++;
+ _gdk_window_process_updates_recurse (gdk_window, region);
+ impl->in_paint_rect_count--;
+
gdk_region_destroy (region);
if (needsInvalidateShadow)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]