[gimp/gtk3-port: 58/235] libgimpwidgets: port to GtkWidget::draw()



commit 67ba15b93792c0e291a18429cb39e64832449bc5
Author: Michael Natterer <mitch gimp org>
Date:   Tue Oct 19 21:10:48 2010 +0200

    libgimpwidgets: port to GtkWidget::draw()

 libgimpwidgets/gimpcolorselect.c |   46 +++++++++++--------------------------
 1 files changed, 14 insertions(+), 32 deletions(-)
---
diff --git a/libgimpwidgets/gimpcolorselect.c b/libgimpwidgets/gimpcolorselect.c
index 99e5d5f..6b178a1 100644
--- a/libgimpwidgets/gimpcolorselect.c
+++ b/libgimpwidgets/gimpcolorselect.c
@@ -214,8 +214,8 @@ static void   gimp_color_select_drop_color      (GtkWidget          *widget,
 static void  gimp_color_select_xy_size_allocate (GtkWidget          *widget,
                                                  GtkAllocation      *allocation,
                                                  GimpColorSelect    *select);
-static gboolean   gimp_color_select_xy_expose   (GtkWidget          *widget,
-                                                 GdkEventExpose     *eevent,
+static gboolean   gimp_color_select_xy_draw     (GtkWidget          *widget,
+                                                 cairo_t            *cr,
                                                  GimpColorSelect    *select);
 static gboolean   gimp_color_select_xy_events   (GtkWidget          *widget,
                                                  GdkEvent           *event,
@@ -223,8 +223,8 @@ static gboolean   gimp_color_select_xy_events   (GtkWidget          *widget,
 static void   gimp_color_select_z_size_allocate (GtkWidget          *widget,
                                                  GtkAllocation      *allocation,
                                                  GimpColorSelect    *select);
-static gboolean   gimp_color_select_z_expose    (GtkWidget          *widget,
-                                                 GdkEventExpose     *eevent,
+static gboolean   gimp_color_select_z_draw      (GtkWidget          *widget,
+                                                 cairo_t            *cr,
                                                  GimpColorSelect    *select);
 static gboolean   gimp_color_select_z_events    (GtkWidget          *widget,
                                                  GdkEvent           *event,
@@ -368,8 +368,8 @@ gimp_color_select_init (GimpColorSelect *select)
   g_signal_connect (select->xy_color, "size-allocate",
                     G_CALLBACK (gimp_color_select_xy_size_allocate),
                     select);
-  g_signal_connect_after (select->xy_color, "expose-event",
-                          G_CALLBACK (gimp_color_select_xy_expose),
+  g_signal_connect_after (select->xy_color, "draw",
+                          G_CALLBACK (gimp_color_select_xy_draw),
                           select);
   g_signal_connect (select->xy_color, "event",
                     G_CALLBACK (gimp_color_select_xy_events),
@@ -399,8 +399,8 @@ gimp_color_select_init (GimpColorSelect *select)
   g_signal_connect (select->z_color, "size-allocate",
                     G_CALLBACK (gimp_color_select_z_size_allocate),
                     select);
-  g_signal_connect_after (select->z_color, "expose-event",
-                          G_CALLBACK (gimp_color_select_z_expose),
+  g_signal_connect_after (select->z_color, "draw",
+                          G_CALLBACK (gimp_color_select_z_draw),
                           select);
   g_signal_connect (select->z_color, "event",
                     G_CALLBACK (gimp_color_select_z_events),
@@ -842,12 +842,11 @@ gimp_color_select_xy_size_allocate (GtkWidget       *widget,
 }
 
 static gboolean
-gimp_color_select_xy_expose (GtkWidget       *widget,
-                             GdkEventExpose  *event,
-                             GimpColorSelect *select)
+gimp_color_select_xy_draw (GtkWidget       *widget,
+                           cairo_t         *cr,
+                           GimpColorSelect *select)
 {
   GtkAllocation  allocation;
-  cairo_t       *cr;
   GdkPixbuf     *pixbuf;
   gint           x, y;
 
@@ -916,12 +915,6 @@ gimp_color_select_xy_expose (GtkWidget       *widget,
 
   gtk_widget_get_allocation (select->xy_color, &allocation);
 
-  cr = gdk_cairo_create (gtk_widget_get_window (widget));
-  gdk_cairo_region (cr, event->region);
-  cairo_clip (cr);
-
-  cairo_translate (cr, allocation.x, allocation.y);
-
   gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
   g_object_unref (pixbuf);
   cairo_paint (cr);
@@ -943,8 +936,6 @@ gimp_color_select_xy_expose (GtkWidget       *widget,
   cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.8);
   cairo_stroke (cr);
 
-  cairo_destroy (cr);
-
   return TRUE;
 }
 
@@ -1048,12 +1039,11 @@ gimp_color_select_z_size_allocate (GtkWidget       *widget,
 }
 
 static gboolean
-gimp_color_select_z_expose (GtkWidget       *widget,
-                            GdkEventExpose  *event,
-                            GimpColorSelect *select)
+gimp_color_select_z_draw (GtkWidget       *widget,
+                          cairo_t         *cr,
+                          GimpColorSelect *select)
 {
   GtkAllocation  allocation;
-  cairo_t       *cr;
   GdkPixbuf     *pixbuf;
   gint           y;
 
@@ -1078,10 +1068,6 @@ gimp_color_select_z_expose (GtkWidget       *widget,
 
   gtk_widget_get_allocation (widget, &allocation);
 
-  cr = gdk_cairo_create (gtk_widget_get_window (widget));
-  gdk_cairo_region (cr, event->region);
-  cairo_clip (cr);
-
   if (! select->transform)
     gimp_color_select_create_transform (select);
 
@@ -1126,8 +1112,6 @@ gimp_color_select_z_expose (GtkWidget       *widget,
                                          NULL, NULL);
     }
 
-  cairo_translate (cr, allocation.x, allocation.y);
-
   gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
   g_object_unref (pixbuf);
   cairo_paint (cr);
@@ -1145,8 +1129,6 @@ gimp_color_select_z_expose (GtkWidget       *widget,
   cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.8);
   cairo_stroke (cr);
 
-  cairo_destroy (cr);
-
   return TRUE;
 }
 


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