[gtk+/rendering-cleanup-next: 124/153] testpixbuf-scale: Connect to draw signal
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup-next: 124/153] testpixbuf-scale: Connect to draw signal
- Date: Sat, 11 Sep 2010 05:01:51 +0000 (UTC)
commit 52f6b07173f815525f2bac04d2dd39a25904c939
Author: Benjamin Otte <otte redhat com>
Date: Thu Sep 9 01:01:35 2010 +0200
testpixbuf-scale: Connect to draw signal
demos/testpixbuf-scale.c | 27 ++++++++++-----------------
1 files changed, 10 insertions(+), 17 deletions(-)
---
diff --git a/demos/testpixbuf-scale.c b/demos/testpixbuf-scale.c
index 6d519f5..dd1b673 100644
--- a/demos/testpixbuf-scale.c
+++ b/demos/testpixbuf-scale.c
@@ -32,30 +32,23 @@ overall_changed_cb (GtkAdjustment *adjustment, gpointer data)
}
gboolean
-expose_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data)
+draw_cb (GtkWidget *widget, cairo_t *cr, int width, int height, gpointer data)
{
- GtkAllocation allocation;
GdkPixbuf *dest;
- cairo_t *cr;
- dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, event->area.width, event->area.height);
+ dest = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height);
- gtk_widget_get_allocation (widget, &allocation);
gdk_pixbuf_composite_color (pixbuf, dest,
- 0, 0, event->area.width, event->area.height,
- -event->area.x, -event->area.y,
- (double) allocation.width / gdk_pixbuf_get_width (pixbuf),
- (double) allocation.height / gdk_pixbuf_get_height (pixbuf),
+ 0, 0, width, height,
+ 0, 0,
+ (double) width / gdk_pixbuf_get_width (pixbuf),
+ (double) height / gdk_pixbuf_get_height (pixbuf),
interp_type, overall_alpha,
- event->area.x, event->area.y, 16, 0xaaaaaa, 0x555555);
-
- cr = gdk_cairo_create (event->window);
+ 0, 0, 16, 0xaaaaaa, 0x555555);
gdk_cairo_set_source_pixbuf (cr, dest, 0, 0);
- gdk_cairo_rectangle (cr, &event->area);
- cairo_fill (cr);
+ cairo_paint (cr);
- cairo_destroy (cr);
g_object_unref (dest);
return TRUE;
@@ -143,8 +136,8 @@ main(int argc, char **argv)
darea = gtk_drawing_area_new ();
gtk_box_pack_start (GTK_BOX (vbox), darea, TRUE, TRUE, 0);
- g_signal_connect (darea, "expose_event",
- G_CALLBACK (expose_cb), NULL);
+ g_signal_connect (darea, "draw",
+ G_CALLBACK (draw_cb), NULL);
gtk_window_set_default_size (GTK_WINDOW (window),
gdk_pixbuf_get_width (pixbuf),
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]