[gimp/gtk3-port: 21/235] app: port to GtkWidget::draw()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gtk3-port: 21/235] app: port to GtkWidget::draw()
- Date: Fri, 7 Oct 2011 10:57:52 +0000 (UTC)
commit 76a8082c0b549a7f62b9e52e8cc1a2defb3cae74
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 2bb348f..8be4a47 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",
@@ -265,8 +265,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);
@@ -276,7 +276,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;
@@ -285,12 +284,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);
@@ -315,11 +308,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]