[gimp/gtk3-port: 69/227] libgimp: port to GtkWidget::draw()



commit 5644cafcd619fd8dd8962f5996e2e4ba05ade5e2
Author: Michael Natterer <mitch gimp org>
Date:   Thu Oct 21 13:08:07 2010 +0200

    libgimp: port to GtkWidget::draw()

 libgimp/gimpgradientselectbutton.c |   22 +++++++---------------
 1 files changed, 7 insertions(+), 15 deletions(-)
---
diff --git a/libgimp/gimpgradientselectbutton.c b/libgimp/gimpgradientselectbutton.c
index 1d2ddde..e278af9 100644
--- a/libgimp/gimpgradientselectbutton.c
+++ b/libgimp/gimpgradientselectbutton.c
@@ -104,8 +104,8 @@ static void gimp_gradient_select_preview_size_allocate
                                                  (GtkWidget                *widget,
                                                   GtkAllocation            *allocation,
                                                   GimpGradientSelectButton *button);
-static gboolean gimp_gradient_select_preview_expose   (GtkWidget                *preview,
-                                                       GdkEventExpose           *event,
+static gboolean gimp_gradient_select_preview_draw     (GtkWidget                *preview,
+                                                       cairo_t                  *cr,
                                                        GimpGradientSelectButton *button);
 
 static void   gimp_gradient_select_drag_data_received (GimpGradientSelectButton *button,
@@ -480,13 +480,12 @@ gimp_gradient_select_preview_size_allocate (GtkWidget                *widget,
 }
 
 static gboolean
-gimp_gradient_select_preview_expose (GtkWidget                *widget,
-                                     GdkEventExpose           *event,
-                                     GimpGradientSelectButton *button)
+gimp_gradient_select_preview_draw (GtkWidget                *widget,
+                                   cairo_t                  *cr,
+                                   GimpGradientSelectButton *button)
 {
   GimpGradientSelectButtonPrivate *priv;
   GtkAllocation                    allocation;
-  cairo_t                         *cr;
   cairo_pattern_t                 *pattern;
   cairo_surface_t                 *surface;
   const gdouble                   *src;
@@ -502,11 +501,6 @@ gimp_gradient_select_preview_expose (GtkWidget                *widget,
 
   gtk_widget_get_allocation (widget, &allocation);
 
-  cr = gdk_cairo_create (event->window);
-
-  gdk_cairo_region (cr, event->region);
-  cairo_clip (cr);
-
   pattern = gimp_cairo_checkerboard_create (cr, GIMP_CHECK_SIZE_SM, NULL, NULL);
   cairo_set_source (cr, pattern);
   cairo_pattern_destroy (pattern);
@@ -543,8 +537,6 @@ gimp_gradient_select_preview_expose (GtkWidget                *widget,
 
   cairo_paint (cr);
 
-  cairo_destroy (cr);
-
   return FALSE;
 }
 
@@ -607,8 +599,8 @@ gimp_gradient_select_button_create_inside (GimpGradientSelectButton *gradient_bu
                     G_CALLBACK (gimp_gradient_select_preview_size_allocate),
                     gradient_button);
 
-  g_signal_connect (priv->preview, "expose-event",
-                    G_CALLBACK (gimp_gradient_select_preview_expose),
+  g_signal_connect (priv->preview, "draw",
+                    G_CALLBACK (gimp_gradient_select_preview_draw),
                     gradient_button);
 
   gtk_widget_show_all (button);


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