[gnome-utils] screenshot: Draw preview widget with Cairo
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-utils] screenshot: Draw preview widget with Cairo
- Date: Wed, 1 Sep 2010 12:57:55 +0000 (UTC)
commit db97a45a4c56cdafdeadfb042215ecf69809723b
Author: Benjamin Otte <otte redhat com>
Date: Wed Sep 1 13:57:40 2010 +0200
screenshot: Draw preview widget with Cairo
https://bugzilla.gnome.org/show_bug.cgi?id=628499
gnome-screenshot/screenshot-dialog.c | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
---
diff --git a/gnome-screenshot/screenshot-dialog.c b/gnome-screenshot/screenshot-dialog.c
index 64d579a..154d90c 100644
--- a/gnome-screenshot/screenshot-dialog.c
+++ b/gnome-screenshot/screenshot-dialog.c
@@ -72,6 +72,7 @@ on_preview_expose_event (GtkWidget *drawing_area,
ScreenshotDialog *dialog = data;
GdkPixbuf *pixbuf = NULL;
gboolean free_pixbuf = FALSE;
+ cairo_t *cr;
/* Stolen from GtkImage. I really should just make the drawing area an
* image some day */
@@ -99,18 +100,14 @@ on_preview_expose_event (GtkWidget *drawing_area,
pixbuf = g_object_ref (dialog->preview_image);
}
- /* FIXME: Draw it insensitive in that case */
- gdk_draw_pixbuf (drawing_area->window,
- drawing_area->style->white_gc,
- pixbuf,
- event->area.x,
- event->area.y,
- event->area.x,
- event->area.y,
- event->area.width,
- event->area.height,
- GDK_RGB_DITHER_NORMAL,
- 0, 0);
+ cr = gdk_cairo_create (drawing_area->window);
+ gdk_cairo_region (cr, event->region);
+ cairo_clip (cr);
+
+ gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
+ cairo_paint (cr);
+
+ cairo_destroy (cr);
g_object_unref (pixbuf);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]