summaryrefslogtreecommitdiff
path: root/src/eom-scroll-view.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/eom-scroll-view.c')
-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