[gimp/gtk3-port: 7/251] libgimpwidgets: port to GtkWidget::draw()



commit db6535e64904c874203b36ab33291da6c4294e57
Author: Michael Natterer <mitch gimp org>
Date:   Fri Oct 15 10:45:53 2010 +0200

    libgimpwidgets: port to GtkWidget::draw()

 libgimpwidgets/gimpcolorarea.c |   18 +++++-------------
 1 files changed, 5 insertions(+), 13 deletions(-)
---
diff --git a/libgimpwidgets/gimpcolorarea.c b/libgimpwidgets/gimpcolorarea.c
index 3f4edec..3cd8009 100644
--- a/libgimpwidgets/gimpcolorarea.c
+++ b/libgimpwidgets/gimpcolorarea.c
@@ -76,8 +76,8 @@ static void      gimp_color_area_size_allocate (GtkWidget          *widget,
                                                 GtkAllocation      *allocation);
 static void      gimp_color_area_state_changed (GtkWidget          *widget,
                                                 GtkStateType        previous_state);
-static gboolean  gimp_color_area_expose        (GtkWidget          *widget,
-                                                GdkEventExpose     *event);
+static gboolean  gimp_color_area_draw          (GtkWidget          *widget,
+                                                cairo_t            *cr);
 static void      gimp_color_area_render_buf    (GtkWidget          *widget,
                                                 gboolean            insensitive,
                                                 GimpColorAreaType   type,
@@ -137,7 +137,7 @@ gimp_color_area_class_init (GimpColorAreaClass *klass)
 
   widget_class->size_allocate      = gimp_color_area_size_allocate;
   widget_class->state_changed      = gimp_color_area_state_changed;
-  widget_class->expose_event       = gimp_color_area_expose;
+  widget_class->draw               = gimp_color_area_draw;
 
   widget_class->drag_begin         = gimp_color_area_drag_begin;
   widget_class->drag_end           = gimp_color_area_drag_end;
@@ -338,12 +338,11 @@ gimp_color_area_state_changed (GtkWidget    *widget,
 }
 
 static gboolean
-gimp_color_area_expose (GtkWidget      *widget,
-                        GdkEventExpose *event)
+gimp_color_area_draw (GtkWidget *widget,
+                      cairo_t   *cr)
 {
   GimpColorArea   *area  = GIMP_COLOR_AREA (widget);
   GtkStyle        *style = gtk_widget_get_style (widget);
-  cairo_t         *cr;
   cairo_surface_t *buffer;
 
   if (! area->buf || ! gtk_widget_is_drawable (widget))
@@ -352,11 +351,6 @@ gimp_color_area_expose (GtkWidget      *widget,
   if (area->needs_render)
     gimp_color_area_render (area);
 
-  cr = gdk_cairo_create (gtk_widget_get_window (widget));
-
-  gdk_cairo_region (cr, event->region);
-  cairo_clip (cr);
-
   buffer = cairo_image_surface_create_for_data (area->buf,
                                                 CAIRO_FORMAT_RGB24,
                                                 area->width,
@@ -378,8 +372,6 @@ gimp_color_area_expose (GtkWidget      *widget,
       cairo_stroke (cr);
     }
 
-  cairo_destroy (cr);
-
   return FALSE;
 }
 



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