[gimp/gtk3-port: 30/226] app: port to GtkWidget::draw()



commit 6031e91357f9c9dce14e1917489335e7b200b8e9
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 2d81b86..80f2cda 100644
--- a/app/widgets/gimpview.c
+++ b/app/widgets/gimpview.c
@@ -63,8 +63,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,
@@ -148,7 +148,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;
@@ -382,29 +382,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]