[gimp/gtk3-port: 42/236] app: port to GtkWidget::draw()



commit 62f892eb349de1654931756c3bc000c8c3eb4aa0
Author: Michael Natterer <mitch gimp org>
Date:   Fri Oct 15 16:11:12 2010 +0200

    app: port to GtkWidget::draw()

 app/widgets/gimpview.c |   34 +++++++++++-----------------------
 1 files changed, 11 insertions(+), 23 deletions(-)
---
diff --git a/app/widgets/gimpview.c b/app/widgets/gimpview.c
index 22465dd..bb83dd6 100644
--- a/app/widgets/gimpview.c
+++ b/app/widgets/gimpview.c
@@ -62,8 +62,8 @@ static void        gimp_view_size_request         (GtkWidget        *widget,
                                                    GtkRequisition   *requisition);
 static void        gimp_view_size_allocate        (GtkWidget        *widget,
                                                    GtkAllocation    *allocation);
-static gboolean    gimp_view_expose_event         (GtkWidget        *widget,
-                                                   GdkEventExpose   *event);
+static gboolean    gimp_view_draw                 (GtkWidget        *widget,
+                                                   cairo_t          *cr);
 static gboolean    gimp_view_button_press_event   (GtkWidget        *widget,
                                                    GdkEventButton   *bevent);
 static gboolean    gimp_view_button_release_event (GtkWidget        *widget,
@@ -147,7 +147,7 @@ gimp_view_class_init (GimpViewClass *klass)
   widget_class->unmap                = gimp_view_unmap;
   widget_class->size_request         = gimp_view_size_request;
   widget_class->size_allocate        = gimp_view_size_allocate;
-  widget_class->expose_event         = gimp_view_expose_event;
+  widget_class->draw                 = gimp_view_draw;
   widget_class->button_press_event   = gimp_view_button_press_event;
   widget_class->button_release_event = gimp_view_button_release_event;
   widget_class->enter_notify_event   = gimp_view_enter_notify_event;
@@ -381,29 +381,17 @@ gimp_view_size_allocate (GtkWidget     *widget,
 }
 
 static gboolean
-gimp_view_expose_event (GtkWidget      *widget,
-                        GdkEventExpose *event)
+gimp_view_draw (GtkWidget *widget,
+                cairo_t   *cr)
 {
-  if (gtk_widget_is_drawable (widget))
-    {
-      GtkAllocation  allocation;
-      cairo_t       *cr;
-
-      gtk_widget_get_allocation (widget, &allocation);
-
-      cr = gdk_cairo_create (event->window);
-      gdk_cairo_region (cr, event->region);
-      cairo_clip (cr);
+  GtkAllocation allocation;
 
-      cairo_translate (cr, allocation.x, allocation.y);
-
-      gimp_view_renderer_draw (GIMP_VIEW (widget)->renderer,
-                               widget, cr,
-                               allocation.width,
-                               allocation.height);
+  gtk_widget_get_allocation (widget, &allocation);
 
-      cairo_destroy (cr);
-    }
+  gimp_view_renderer_draw (GIMP_VIEW (widget)->renderer,
+                           widget, cr,
+                           allocation.width,
+                           allocation.height);
 
   return FALSE;
 }



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