libgimpwidgets: port to GtkWidget::draw()

This commit is contained in:
Michael Natterer 2010-10-19 21:10:48 +02:00
parent 86e033d495
commit 4477ad84de
1 changed files with 14 additions and 32 deletions

View File

@ -218,8 +218,8 @@ static void gimp_color_select_drop_color (GtkWidget *widget,
static void gimp_color_select_xy_size_allocate (GtkWidget *widget,
GtkAllocation *allocation,
GimpColorSelect *select);
static gboolean gimp_color_select_xy_expose (GtkWidget *widget,
GdkEventExpose *eevent,
static gboolean gimp_color_select_xy_draw (GtkWidget *widget,
cairo_t *cr,
GimpColorSelect *select);
static gboolean gimp_color_select_xy_events (GtkWidget *widget,
GdkEvent *event,
@ -227,8 +227,8 @@ static gboolean gimp_color_select_xy_events (GtkWidget *widget,
static void gimp_color_select_z_size_allocate (GtkWidget *widget,
GtkAllocation *allocation,
GimpColorSelect *select);
static gboolean gimp_color_select_z_expose (GtkWidget *widget,
GdkEventExpose *eevent,
static gboolean gimp_color_select_z_draw (GtkWidget *widget,
cairo_t *cr,
GimpColorSelect *select);
static gboolean gimp_color_select_z_events (GtkWidget *widget,
GdkEvent *event,
@ -380,8 +380,8 @@ gimp_color_select_init (GimpColorSelect *select)
g_signal_connect (select->xy_color, "size-allocate",
G_CALLBACK (gimp_color_select_xy_size_allocate),
select);
g_signal_connect_after (select->xy_color, "expose-event",
G_CALLBACK (gimp_color_select_xy_expose),
g_signal_connect_after (select->xy_color, "draw",
G_CALLBACK (gimp_color_select_xy_draw),
select);
g_signal_connect (select->xy_color, "event",
G_CALLBACK (gimp_color_select_xy_events),
@ -411,8 +411,8 @@ gimp_color_select_init (GimpColorSelect *select)
g_signal_connect (select->z_color, "size-allocate",
G_CALLBACK (gimp_color_select_z_size_allocate),
select);
g_signal_connect_after (select->z_color, "expose-event",
G_CALLBACK (gimp_color_select_z_expose),
g_signal_connect_after (select->z_color, "draw",
G_CALLBACK (gimp_color_select_z_draw),
select);
g_signal_connect (select->z_color, "event",
G_CALLBACK (gimp_color_select_z_events),
@ -890,12 +890,11 @@ gimp_color_select_xy_size_allocate (GtkWidget *widget,
}
static gboolean
gimp_color_select_xy_expose (GtkWidget *widget,
GdkEventExpose *event,
GimpColorSelect *select)
gimp_color_select_xy_draw (GtkWidget *widget,
cairo_t *cr,
GimpColorSelect *select)
{
GtkAllocation allocation;
cairo_t *cr;
GdkPixbuf *pixbuf;
gint x, y;
@ -964,12 +963,6 @@ gimp_color_select_xy_expose (GtkWidget *widget,
gtk_widget_get_allocation (select->xy_color, &allocation);
cr = gdk_cairo_create (gtk_widget_get_window (widget));
gdk_cairo_region (cr, event->region);
cairo_clip (cr);
cairo_translate (cr, allocation.x, allocation.y);
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
g_object_unref (pixbuf);
cairo_paint (cr);
@ -991,8 +984,6 @@ gimp_color_select_xy_expose (GtkWidget *widget,
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.8);
cairo_stroke (cr);
cairo_destroy (cr);
return TRUE;
}
@ -1096,12 +1087,11 @@ gimp_color_select_z_size_allocate (GtkWidget *widget,
}
static gboolean
gimp_color_select_z_expose (GtkWidget *widget,
GdkEventExpose *event,
GimpColorSelect *select)
gimp_color_select_z_draw (GtkWidget *widget,
cairo_t *cr,
GimpColorSelect *select)
{
GtkAllocation allocation;
cairo_t *cr;
GdkPixbuf *pixbuf;
gint y;
@ -1126,10 +1116,6 @@ gimp_color_select_z_expose (GtkWidget *widget,
gtk_widget_get_allocation (widget, &allocation);
cr = gdk_cairo_create (gtk_widget_get_window (widget));
gdk_cairo_region (cr, event->region);
cairo_clip (cr);
if (! select->transform)
gimp_color_select_create_transform (select);
@ -1174,8 +1160,6 @@ gimp_color_select_z_expose (GtkWidget *widget,
NULL, NULL);
}
cairo_translate (cr, allocation.x, allocation.y);
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
g_object_unref (pixbuf);
cairo_paint (cr);
@ -1193,8 +1177,6 @@ gimp_color_select_z_expose (GtkWidget *widget,
cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 0.8);
cairo_stroke (cr);
cairo_destroy (cr);
return TRUE;
}