After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 500787 - translation gets ignored when rendering an svg with cairo in the context of a cairo_push_group()
translation gets ignored when rendering an svg with cairo in the context of a...
Status: RESOLVED FIXED
Product: librsvg
Classification: Core
Component: general
2.18.x
Other Linux
: Normal normal
: ---
Assigned To: librsvg maintainers
librsvg maintainers
Depends on:
Blocks:
 
 
Reported: 2007-12-01 02:37 UTC by Bertram Felgenhauer
Modified: 2008-01-19 16:47 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
test case (2.20 KB, text/plain)
2007-12-01 02:40 UTC, Bertram Felgenhauer
  Details
proposed fix (5.53 KB, patch)
2007-12-01 02:41 UTC, Bertram Felgenhauer
none Details | Review
proposed fix (9.80 KB, patch)
2007-12-19 16:57 UTC, Bertram Felgenhauer
committed Details | Review
related cleanup patch (3.41 KB, patch)
2007-12-19 17:01 UTC, Bertram Felgenhauer
committed Details | Review

Description Bertram Felgenhauer 2007-12-01 02:37:33 UTC
When rendering an SVG within a cairo_push_group context, the SVG does not translated properly; instead it is adjusted to touch the upper left corner of the underlying surface.

I'll attach a small program that demonstrates the issue, courtesy of Carl Worth. It produces two output images which should be identical.

Analysis. This behaviour was introduced in the patch for #412682 - changing the device offset within a cairo_push_group has no effect.

Fix. We can get the same effect as changing the device offset by adjusting cairo's ctm for the original context appropriately. I'll attach a patch.
Comment 1 Bertram Felgenhauer 2007-12-01 02:40:09 UTC
Created attachment 99944 [details]
test case
Comment 2 Bertram Felgenhauer 2007-12-01 02:41:24 UTC
Created attachment 99945 [details] [review]
proposed fix
Comment 3 Emmanuel Pacaud 2007-12-06 13:26:06 UTC
The patch looks fine and passes the regression tests.

I guess it should be applied.

Dom ?
Comment 4 Bertram Felgenhauer 2007-12-19 05:51:06 UTC
I'm afraid the patch above is incomplete, most notably because it fails to make adjustments in cairo_clip.c. I'll post an improved patch later.
Comment 5 Bertram Felgenhauer 2007-12-19 16:57:42 UTC
Created attachment 101266 [details] [review]
proposed fix

Ok, here's the improved patch as promised. It applies the offset for clips and masks, too, which the previous patch didn't. It passes the test suite and the testcase, and some tests of my own. (I'll look at adding test cases that involve transformations to the test suite when I find the time.)
Comment 6 Bertram Felgenhauer 2007-12-19 17:01:25 UTC
Created attachment 101268 [details] [review]
related cleanup patch

This patch applies on top of the proposed fix; it removes some cairo_save() / cairo_restore() pairs that are now superfluous. I've tested this one as well.

The remaining cairo_save() and cairo_restore() have different purposes: one pair saves and restores the original caller's cairo state, and one pair saves and restores the clipping area around groups (which may add their own clipping).
Comment 7 Dominic Lachowicz 2008-01-19 16:47:59 UTC
Thanks, Bertram!