[librsvg/librsvg-2.40] Backport: rsvg_cairo_render_new(): Initialize ->bbox to the identity affine



commit 14602403106d13431d874c6342c63d3487a005e1
Author: Federico Mena Quintero <federico gnome org>
Date:   Wed Dec 7 13:57:08 2016 -0600

    Backport: rsvg_cairo_render_new(): Initialize ->bbox to the identity affine
    
    From commit d37e275bc6f6d3ff1d81680433903574f6a508d1
    
    Otherwise, when filters cause rsvg_get_surface_of_node() to be called,
    that function will create a RsvgCairoRender with an all-zeros bbox and
    bbox.affine.
    
    This all-zeros affine causes cairo_matrix_invert() inside
    RsvbBbox::clip()/insert() to fail.  In the C version it failed silently,
    since it ignored failures from cairo_matrix_invert().  The Rust version
    panic()s when a matrix can't be inverted.

 rsvg-cairo-render.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/rsvg-cairo-render.c b/rsvg-cairo-render.c
index f958ba3..19ba532 100644
--- a/rsvg-cairo-render.c
+++ b/rsvg-cairo-render.c
@@ -67,6 +67,7 @@ RsvgCairoRender *
 rsvg_cairo_render_new (cairo_t * cr, double width, double height)
 {
     RsvgCairoRender *cairo_render = g_new0 (RsvgCairoRender, 1);
+    cairo_matrix_t matrix;
 
     cairo_render->super.type = RSVG_RENDER_TYPE_CAIRO;
     cairo_render->super.free = rsvg_cairo_render_free;
@@ -93,6 +94,9 @@ rsvg_cairo_render_new (cairo_t * cr, double width, double height)
     cairo_render->font_map_for_testing = NULL;
 #endif
 
+    cairo_matrix_init_identity (&matrix);
+    rsvg_bbox_init (&cairo_render->bbox, &matrix);
+
     return cairo_render;
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]