[gimp/gtk3-port: 8/229] libgimpwidgets: port to GtkWidget::draw()



commit 1ff0a8727b0f13660e0ea5597c528b9de65c80cb
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 c60eb4b..7c52789 100644
--- a/libgimpwidgets/gimpcolorarea.c
+++ b/libgimpwidgets/gimpcolorarea.c
@@ -77,8 +77,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,
@@ -138,7 +138,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;
@@ -339,12 +339,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))
@@ -353,11 +352,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,
@@ -379,8 +373,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]