[gtk+/rendering-cleanup-next: 49/153] iconview: Check if the cr is clipped instead of using region



commit 5ef3cee32293f782119febea4dd7d5ad8e77a122
Author: Benjamin Otte <otte redhat com>
Date:   Mon Sep 6 18:44:32 2010 +0200

    iconview: Check if the cr is clipped instead of using region

 gtk/gtkiconview.c |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c
index e203f27..ebb572a 100644
--- a/gtk/gtkiconview.c
+++ b/gtk/gtkiconview.c
@@ -1552,6 +1552,16 @@ gtk_icon_view_size_allocate (GtkWidget      *widget,
 }
 
 static gboolean
+is_clipped (cairo_t *cr)
+{
+  double x1, y1, x2, y2;
+
+  cairo_clip_extents (cr, &x1, &y1, &x2, &y2);
+
+  return x1 >= x2 && y1 >= y2;
+}
+
+static gboolean
 gtk_icon_view_expose (GtkWidget *widget,
 		      GdkEventExpose *expose)
 {
@@ -1589,19 +1599,13 @@ gtk_icon_view_expose (GtkWidget *widget,
   for (icons = icon_view->priv->items; icons; icons = icons->next) 
     {
       GtkIconViewItem *item = icons->data;
-      GdkRectangle area;
       
       cairo_save (cr);
 
       cairo_rectangle (cr, item->x, item->y, item->width, item->height);
       cairo_clip (cr);
 
-      area.x = item->x;
-      area.y = item->y;
-      area.width = item->width;
-      area.height = item->height;
-	
-      if (cairo_region_contains_rectangle (expose->region, &area) != CAIRO_REGION_OVERLAP_OUT)
+      if (!is_clipped (cr))
         {
           gtk_icon_view_paint_item (icon_view, cr, item,
                                     item->x, item->y,



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]