DPIswitcher produces incorrect results on top-level elements with transformations.
Testing with Inkscape 1.1 dev, using latest extensions from master.
In the attached sample file docscale_10in_transforms_use3.svg, note the position of the rectangles with the heavy outlines:
After running Extensions>Document>DPI 96 to 90, the visual result is as follows:
While most objects in the file are resized correctly, the heavy-outlined rectangles end up in the wrong position.
The outlined rectangles, unlike other top-level svg elements in this file, are in a group that has a transformation attribute:
<g
id="root_group_transform"
transform="translate(768, 384) rotate(180)"
[...]
The apparent cause of this is that the scaling is applied as follows:
element.transform.add_scale(width_scale, height_scale)
This appears to be the incorrect approach (post-multiplication by the scaling factor, not pre-multiplication), if for no other reason that it produces the incorrect results.
Replacing that snippet with the following (pre-multiplication instead of post-multiplication) resolves the issue:
scale_mat = transforms.Transform(scale=(width_scale, height_scale))
element.transform = scale_mat * element.transform
After this change, test_dpiswitcher.py
still passes, suggesting that the tests should likely be improved as well.
Merge request coming shortly.
Aside: This issue became apparent some months ago while researching #175 (closed). It was this sign error that led me previously down the wrong path (see issue #255 (closed)) and led to that merge request that had to be reverted. I believe that the function was correct, but this use of it was not.