[gimp/gtk3-port: 24/237] app: port to GtkWidget::draw()



commit 3056856b5a8564e02abaffecf6c80d67fa12528a
Author: Michael Natterer <mitch gimp org>
Date:   Fri Oct 15 13:05:30 2010 +0200

    app: port to GtkWidget::draw()

 app/widgets/gimpcolorframe.c |   21 ++++++---------------
 1 files changed, 6 insertions(+), 15 deletions(-)
---
diff --git a/app/widgets/gimpcolorframe.c b/app/widgets/gimpcolorframe.c
index 02977b3..90ae96b 100644
--- a/app/widgets/gimpcolorframe.c
+++ b/app/widgets/gimpcolorframe.c
@@ -57,8 +57,8 @@ static void       gimp_color_frame_set_property  (GObject        *object,
 
 static void       gimp_color_frame_style_set     (GtkWidget      *widget,
                                                   GtkStyle       *prev_style);
-static gboolean   gimp_color_frame_expose        (GtkWidget      *widget,
-                                                  GdkEventExpose *eevent);
+static gboolean   gimp_color_frame_draw          (GtkWidget      *widget,
+                                                  cairo_t        *cr);
 
 static void       gimp_color_frame_menu_callback (GtkWidget      *widget,
                                                   GimpColorFrame *frame);
@@ -81,7 +81,7 @@ gimp_color_frame_class_init (GimpColorFrameClass *klass)
   object_class->set_property = gimp_color_frame_set_property;
 
   widget_class->style_set    = gimp_color_frame_style_set;
-  widget_class->expose_event = gimp_color_frame_expose;
+  widget_class->draw         = gimp_color_frame_draw;
 
   g_object_class_install_property (object_class, PROP_MODE,
                                    g_param_spec_enum ("mode",
@@ -264,8 +264,8 @@ gimp_color_frame_style_set (GtkWidget *widget,
 }
 
 static gboolean
-gimp_color_frame_expose (GtkWidget      *widget,
-                         GdkEventExpose *eevent)
+gimp_color_frame_draw (GtkWidget *widget,
+                       cairo_t   *cr)
 {
   GimpColorFrame *frame = GIMP_COLOR_FRAME (widget);
 
@@ -275,7 +275,6 @@ gimp_color_frame_expose (GtkWidget      *widget,
       GtkAllocation  allocation;
       GtkAllocation  menu_allocation;
       GtkAllocation  color_area_allocation;
-      cairo_t       *cr;
       gchar          buf[8];
       gint           w, h;
       gdouble        scale;
@@ -284,12 +283,6 @@ gimp_color_frame_expose (GtkWidget      *widget,
       gtk_widget_get_allocation (frame->menu, &menu_allocation);
       gtk_widget_get_allocation (frame->color_area, &color_area_allocation);
 
-      cr = gdk_cairo_create (gtk_widget_get_window (widget));
-      gdk_cairo_region (cr, eevent->region);
-      cairo_clip (cr);
-
-      cairo_translate (cr, allocation.x, allocation.y);
-
       gdk_cairo_set_source_color (cr, &style->light[GTK_STATE_NORMAL]);
 
       g_snprintf (buf, sizeof (buf), "%d", frame->number);
@@ -314,11 +307,9 @@ gimp_color_frame_expose (GtkWidget      *widget,
                       color_area_allocation.height / 2.0) / scale - h / 2.0);
       pango_cairo_show_layout (cr, frame->number_layout);
       cairo_fill (cr);
-
-      cairo_destroy (cr);
     }
 
-  return GTK_WIDGET_CLASS (parent_class)->expose_event (widget, eevent);
+  return GTK_WIDGET_CLASS (parent_class)->draw (widget, cr);
 }
 
 



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