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



commit 22b2ac0d09da0e3b61cf96bcb60f7bebb25989b8
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 adf522f..634f0f5 100644
--- a/app/widgets/gimpcolorframe.c
+++ b/app/widgets/gimpcolorframe.c
@@ -59,8 +59,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);
@@ -83,7 +83,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",
@@ -267,8 +267,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);
 
@@ -278,7 +278,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;
@@ -287,12 +286,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);
@@ -316,11 +309,9 @@ gimp_color_frame_expose (GtkWidget      *widget,
                       menu_allocation.height / 2.0 +
                       color_area_allocation.height / 2.0) / scale - h / 2.0);
       pango_cairo_show_layout (cr, frame->number_layout);
-
-      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]