[gtk+/popovers: 17/26] pixelcache: check whether cached surface and cairo_t scales match
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/popovers: 17/26] pixelcache: check whether cached surface and cairo_t scales match
- Date: Wed, 25 Dec 2013 12:27:58 +0000 (UTC)
commit 741fa0a8fc2396f41376701c5f97bcf14045631d
Author: Carlos Garnacho <carlosg gnome org>
Date: Wed Dec 11 15:41:08 2013 +0100
pixelcache: check whether cached surface and cairo_t scales match
gtk/gtkpixelcache.c | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkpixelcache.c b/gtk/gtkpixelcache.c
index 411a75e..a6dc5c0 100644
--- a/gtk/gtkpixelcache.c
+++ b/gtk/gtkpixelcache.c
@@ -395,6 +395,19 @@ blow_cache_cb (gpointer user_data)
return G_SOURCE_REMOVE;
}
+static gboolean
+context_is_unscaled (cairo_t *cr)
+{
+ cairo_matrix_t matrix;
+ gdouble x, y;
+
+ x = y = 1;
+ cairo_get_matrix (cr, &matrix);
+ cairo_matrix_transform_distance (&matrix, &x, &y);
+
+ return x == 1 && y == 1;
+}
+
void
_gtk_pixel_cache_draw (GtkPixelCache *cache,
@@ -419,7 +432,7 @@ _gtk_pixel_cache_draw (GtkPixelCache *cache,
_gtk_pixel_cache_set_position (cache, view_rect, canvas_rect);
_gtk_pixel_cache_repaint (cache, draw, view_rect, canvas_rect, user_data);
- if (cache->surface &&
+ if (cache->surface && context_is_unscaled (cr) &&
/* Don't use backing surface if rendering elsewhere */
cairo_surface_get_type (cache->surface) == cairo_surface_get_type (cairo_get_target (cr)))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]