summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-07-24 15:15:58 +0200
committerinfirit <[email protected]>2014-07-24 20:17:46 +0200
commit45d1ebfc67a1bd33bc0232ed658dc5e02c13a612 (patch)
tree406b1711d04d36e264d845508696f26e49635a2e
parent661dbc7df871f63946cfd67b7458b1228080932c (diff)
downloadeom-45d1ebfc67a1bd33bc0232ed658dc5e02c13a612.tar.bz2
eom-45d1ebfc67a1bd33bc0232ed658dc5e02c13a612.tar.xz
Use gdk_window_create_similar_surface() for EomScrollView
Based on eog commit 648302091b5517b5da96c4277fbee8f13c125938 From Claudio Saavedra <[email protected]>
-rw-r--r--src/eom-scroll-view.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/eom-scroll-view.c b/src/eom-scroll-view.c
index fcd44ab..eb1d53b 100644
--- a/src/eom-scroll-view.c
+++ b/src/eom-scroll-view.c
@@ -170,20 +170,25 @@ G_DEFINE_TYPE (EomScrollView, eom_scroll_view, GTK_TYPE_TABLE)
---------------------------------*/
static cairo_surface_t *
-create_surface_from_pixbuf (GdkPixbuf *pixbuf)
+create_surface_from_pixbuf (EomScrollView *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;
+ content = CAIRO_CONTENT_COLOR;
+ }
- surface = cairo_image_surface_create (format,
- gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf));
+ 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);
@@ -1880,7 +1885,7 @@ update_pixbuf (EomScrollView *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