GNOME Bugzilla – Bug 757226
librsvg2-2: rect not rendered without scaling
Last modified: 2017-12-13 18:12:05 UTC
Created attachment 314267 [details] Test program Copied from https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=803201 on Debian maintainer's request. Package: librsvg2-2 Version: 2.40.5-1 Severity: normal The attached test program (compiled with gcc `pkg-config --cflags --libs librsvg-2.0` test.c) gives a correct output (a rectangle filling the upper left quadrant) when rendered with scale 2, and no output with scale 1. The bug seems to be triggered by the <path>, but affects the <rect>. The radialGradient also seems necessary to trigger the bug. The bug may be related to #764640, though this one happens always AFAICT (and in jessie where I couldn't reproduce #764640). -- System Information: Debian Release: 8.2 APT prefers stable-updates APT policy: (500, 'stable-updates'), (500, 'proposed-updates'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 3.16.0-4-amd64 (SMP w/8 CPU cores) Locale: LANG=de_DE, LC_CTYPE=de_DE (charmap=ISO-8859-1) Shell: /bin/sh linked to /bin/dash Init: systemd (via /run/systemd/system) Versions of packages librsvg2-2 depends on: ii libc6 2.19-18+deb8u1 ii libcairo2 1.14.0-2.1 ii libcroco3 0.6.8-3+b1 ii libgdk-pixbuf2.0-0 2.31.1-2+deb8u2 ii libglib2.0-0 2.42.1-1 ii libpango-1.0-0 1.36.8-3 ii libpangocairo-1.0-0 1.36.8-3 ii libxml2 2.9.1+dfsg1-5 ii multiarch-support 2.19-18+deb8u1 Versions of packages librsvg2-2 recommends: ii librsvg2-common 2.40.5-1 Versions of packages librsvg2-2 suggests: ii librsvg2-bin 2.40.5-1
Here the problem is that the path at scale 1 has a 'fill_extent' that is (rounded) empty and is used as the object bounding box to evaluate the radial gradient lengths. This results in setting an invalid (singular) pattern matrix. When the pattern is used as source for the fill operation the cairo context sets its error status and stops executing anything. Obviously if cairo reports the fill extent is empty it is better to avoid using the invalid pattern as source. In short here: https://git.gnome.org/browse/librsvg/tree/rsvg-cairo-draw.c#n149 setting the source only when cairo_matrix_invert returned CAIRO_STATUS_SUCCESS solves this problem. A similar check could be also in _set_source_rsvg_linear_gradient and perhaps few g_warn_if_fail (CAIRO_STATUS_SUCCESS == cairo_matrix_invert (... g_warn_if_fail (CAIRO_STATUS_SUCCESS == cairo_status (... could be added, enabled when configuring with --enable-debug
-- GitLab Migration Automatic Message -- This bug has been migrated to GNOME's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/librsvg/issues/123.