[eog] Use gdk_window_create_similar_surface() for EogScrollView
- From: Claudio Saavedra <csaavedra src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [eog] Use gdk_window_create_similar_surface() for EogScrollView
- Date: Wed, 8 Sep 2010 16:43:05 +0000 (UTC)
commit 648302091b5517b5da96c4277fbee8f13c125938
Author: Claudio Saavedra <csaavedra igalia com>
Date: Mon Aug 16 17:23:50 2010 +0300
Use gdk_window_create_similar_surface() for EogScrollView
https://bugzilla.gnome.org/show_bug.cgi?id=626795
src/eog-scroll-view.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/src/eog-scroll-view.c b/src/eog-scroll-view.c
index 2dbd7b2..784d70d 100644
--- a/src/eog-scroll-view.c
+++ b/src/eog-scroll-view.c
@@ -183,20 +183,24 @@ G_DEFINE_TYPE (EogScrollView, eog_scroll_view, GTK_TYPE_TABLE)
---------------------------------*/
static cairo_surface_t *
-create_surface_from_pixbuf (GdkPixbuf *pixbuf)
+create_surface_from_pixbuf (EogScrollView *view, GdkPixbuf *pixbuf)
{
cairo_surface_t *surface;
cairo_t *cr;
cairo_format_t format;
+ cairo_content_t content;
- if (gdk_pixbuf_get_has_alpha (pixbuf))
+ if (gdk_pixbuf_get_has_alpha (pixbuf)) {
format = CAIRO_FORMAT_ARGB32;
- else
+ content = CAIRO_CONTENT_COLOR | CAIRO_CONTENT_ALPHA;
+ } else {
format = CAIRO_FORMAT_RGB24;
-
- surface = cairo_image_surface_create (format,
- gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf));
+ content = CAIRO_CONTENT_COLOR;
+ }
+ surface = gdk_window_create_similar_surface (gtk_widget_get_window (view->priv->display),
+ content,
+ gdk_pixbuf_get_width (pixbuf),
+ gdk_pixbuf_get_height (pixbuf));
cr = cairo_create (surface);
gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0);
cairo_paint (cr);
@@ -1888,7 +1892,7 @@ update_pixbuf (EogScrollView *view, GdkPixbuf *pixbuf)
if (priv->surface) {
cairo_surface_destroy (priv->surface);
}
- priv->surface = create_surface_from_pixbuf (priv->pixbuf);
+ priv->surface = create_surface_from_pixbuf (view, priv->pixbuf);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]