Subject: Re: bug#44065: 28.0.50; SVG image not shown completely

From: Andy Moreton <[email-masked]>
Date: Sun, 25 Oct 2020 12:26:59 +0000

On Sat 24 Oct 2020, Eli Zaretskii wrote:

>> Date: Sat, 24 Oct 2020 18:01:24 +0100
>> From: Alan Third <[email-masked]>
>> Cc: Andy Moreton <[email-masked]>, [email-masked]
>> 
>> On Sat, Oct 24, 2020 at 10:09:59AM +0300, Eli Zaretskii wrote:
>> > 
>> > (We cannot just call a new function from an image library without
>> > loading it from its DLL at run time on MS-Windows.)
>> 
>> Ah, that's not something I was aware of. Thanks for fixing it.
>
> No sweat.  And thanks for fixing the original problem to begin with.

A new report in bug#44206 shows that this patch caused other problems.

The docs for rsvg_handle_get_geometry_for_layer show it does not report
minimum sizes, as it ignores clipping regions. Thus for an SVG file
which contains a small clipping region applied to a larger image, the
reported sizes are incorrect.

Also, rsvg_handle_get_geometry_for_layer returns a gboolean, which the
docs do not describe, but other API functions return TRUE for success
and FALSE for failure. This should be checked.

Running under gdb with the image from bug#44206 shows that the bounds
reported by rsvg_handle_get_geometry_for_layer are zero (so the
functions may have failed and returned FALSE).

The original report here showed that rsvg_handle_get_dimensions did not
alwyas return the correct results. It is documented to require a prior
call to rsvg_handle_set_dpi to give correct results, but that is not
called in image.c.

Perhaps this can be fixed by reverting to the original code with
addition of a call to rsvg_handle_set_dpi or rsvg_handle_set_dpi_x_y
before calling rsvg_handle_get_dimensions.

    AndyM