[cairo] possible bug with cairo_scale & librsvg

Matthew Bernstein mwb at globalmaritime.com
Wed Oct 11 05:51:56 PDT 2006


Hello,

I'm trying to track down a bug rendering SVG files with librsvg if 
cairo_scale is used with a factor other than 1.0.

Much of the SVG renders correctly, but certain elements appear to be 
cropped.  The cropping occurs using both Win32 surfaces and PDF 
surfaces, and appears to definitely be cropping, as opposed to 
subsequent overprinting with a blank rectangle, as the rendering is 
sufficiently slow that I'm sure I would see it prior to being erased if 
that were the case.

Examples here: http://downloads.globalmaritime.com/ts/cairo/

I'm not entirely sure whether the problem lies with librsvg, cairo or 
the SVG itself (produced from the Matplotlib Python library), but logic 
would suggest that if it renders correctly at 1.0, then librsvg is doing 
its bit correctly?  Cairo is 1.2.4, librsvg is 2.16.0 (pango 1.14.5, 
libxml2 2.6.26).

The only other reference I could find was this, but I'm not sure if it's 
the same problem or not: 
http://lists.freedesktop.org/archives/cairo/2005-January/002512.html

Can provide full demo code & the SVG if necessary, does this ring any 
bells with anyone, or could anybody suggest a place to start hunting for 
the problem (feel like it's a needle in a haystack job starting with 
several interlinked projects I'm not familiar with)...

Relevant code segment stripped to minimum:

            surf = cairo_win32_surface_create(dc);
            ctx = cairo_create(surf);

            cairo_scale(ctx, 0.5, 0.5);

            RsvgHandle *h = rsvg_handle_new_from_file("test.svg", &error);
            rsvg_handle_render_cairo(h, ctx);
            rsvg_handle_free(h);

            cairo_surface_flush(surf);
            cairo_surface_destroy(surf);

            cairo_destroy(ctx);

Thanks,
Matthew


More information about the cairo mailing list