[poppler] poppler/CairoOutputDev.cc

Carlos Garcia Campos carlosgc at kemper.freedesktop.org
Mon Aug 31 09:14:38 PDT 2015


 poppler/CairoOutputDev.cc |   30 ++++++++----------------------
 1 file changed, 8 insertions(+), 22 deletions(-)

New commits:
commit 72c0162258f2630a3bb11b9c1078ec1ec2812788
Author: Jason Crain <jason at aquaticape.us>
Date:   Tue Aug 18 01:34:10 2015 -0500

    cairo: fix size of transparency group surface
    
    Under rotation cairo_surface_create_similar_clip will create a surface
    with incorect width/height.  Rely on cairo to do the correct
    calculation.
    
    Bug #66229

diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index a86ec12..20ae90d 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -1433,29 +1433,15 @@ static inline int splashFloor(SplashCoord x) {
 static
 cairo_surface_t *cairo_surface_create_similar_clip (cairo_t *cairo, cairo_content_t content)
 {
-  double x1, y1, x2, y2;
-  int width, height;
-  cairo_clip_extents (cairo, &x1, &y1, &x2, &y2);
-  cairo_matrix_t matrix;
-  cairo_get_matrix (cairo, &matrix);
-  //cairo_matrix_transform_point(&matrix, &x1, &y1);
-  //cairo_matrix_transform_point(&matrix, &x2, &y2);*/
-  cairo_user_to_device(cairo, &x1, &y1);
-  cairo_user_to_device(cairo, &x2, &y2);
-  width = splashCeil(x2) - splashFloor(x1);
-  //XXX: negative matrix
-  ////height = splashCeil(y2) - splashFloor(y1);
-  height = splashFloor(y1) - splashCeil(y2);
-  cairo_surface_t *target = cairo_get_target (cairo);
-  cairo_surface_t *result;
-
-  result = cairo_surface_create_similar (target, content, width, height);
-  double x_offset, y_offset;
-    cairo_surface_get_device_offset(target, &x_offset, &y_offset);
-    cairo_surface_set_device_offset(result, x_offset, y_offset);
+  cairo_pattern_t *pattern;
+  cairo_surface_t *surface = NULL;
 
- 
-  return result;
+  cairo_push_group_with_content (cairo, content);
+  pattern = cairo_pop_group (cairo);
+  cairo_pattern_get_surface (pattern, &surface);
+  cairo_surface_reference (surface);
+  cairo_pattern_destroy (pattern);
+  return surface;
 }
 
 


More information about the poppler mailing list