[gimp/gtk3-port: 48/234] libgimpwidgets: port to GtkWidget::draw()



commit b541e4b4e93eac345924f0876085adb24994f810
Author: Michael Natterer <mitch gimp org>
Date:   Tue Oct 19 19:07:49 2010 +0200

    libgimpwidgets: port to GtkWidget::draw()

 libgimpwidgets/gimppreviewarea.c |   17 +++++------------
 1 files changed, 5 insertions(+), 12 deletions(-)
---
diff --git a/libgimpwidgets/gimppreviewarea.c b/libgimpwidgets/gimppreviewarea.c
index 02b6fd3..c42bf07 100644
--- a/libgimpwidgets/gimppreviewarea.c
+++ b/libgimpwidgets/gimppreviewarea.c
@@ -88,8 +88,8 @@ static void      gimp_preview_area_get_property      (GObject          *object,
 
 static void      gimp_preview_area_size_allocate     (GtkWidget        *widget,
                                                       GtkAllocation    *allocation);
-static gboolean  gimp_preview_area_expose            (GtkWidget        *widget,
-                                                      GdkEventExpose   *event);
+static gboolean  gimp_preview_area_widget_draw       (GtkWidget        *widget,
+                                                      cairo_t          *cr);
 
 static void      gimp_preview_area_queue_draw        (GimpPreviewArea  *area,
                                                       gint              x,
@@ -119,7 +119,7 @@ gimp_preview_area_class_init (GimpPreviewAreaClass *klass)
   object_class->get_property  = gimp_preview_area_get_property;
 
   widget_class->size_allocate = gimp_preview_area_size_allocate;
-  widget_class->expose_event  = gimp_preview_area_expose;
+  widget_class->draw          = gimp_preview_area_widget_draw;
 
   g_object_class_install_property (object_class, PROP_CHECK_SIZE,
                                    g_param_spec_enum ("check-size",
@@ -266,15 +266,14 @@ gimp_preview_area_size_allocate (GtkWidget     *widget,
 }
 
 static gboolean
-gimp_preview_area_expose (GtkWidget      *widget,
-                          GdkEventExpose *event)
+gimp_preview_area_widget_draw (GtkWidget *widget,
+                               cairo_t   *cr)
 {
   GimpPreviewArea        *area = GIMP_PREVIEW_AREA (widget);
   GimpPreviewAreaPrivate *priv = GET_PRIVATE (area);
   GtkAllocation           allocation;
   GdkPixbuf              *pixbuf;
   GdkRectangle            rect;
-  cairo_t                *cr;
 
   if (! area->buf)
     return FALSE;
@@ -330,15 +329,9 @@ gimp_preview_area_expose (GtkWidget      *widget,
                                          NULL, NULL);
     }
 
-  cr = gdk_cairo_create (gtk_widget_get_window (widget));
-
-  gdk_cairo_region (cr, event->region);
-  cairo_clip (cr);
-
   gdk_cairo_set_source_pixbuf (cr, pixbuf, rect.x, rect.y);
   cairo_paint (cr);
 
-  cairo_destroy (cr);
   g_object_unref (pixbuf);
 
   return FALSE;


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