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



commit a72cadb7143c748d0133e48c751365d8b76df5cb
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 6a11aeb..254ca28 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",
@@ -259,15 +259,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;
@@ -323,15 +322,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]