Transformed non-1:1 SVG <pattern>s are very blurry
Categories
(Core :: SVG, defect)
Tracking
()
People
(Reporter: tigt, Assigned: longsonr)
Details
Attachments
(3 files, 1 obsolete file)
User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/111.0
Steps to reproduce:
Test-case uploaded to bug, also available on CodePen: https://codepen.io/tigt/pen/dyqZjXj/47d58b15e597b84fa95f7a6268ccfa47?editors=1000
- Create an SVG
<pattern>that has a non-square surface area -- usually aviewBoxwhere its width and height differ. - Transform the pattern using
patternTransform. - Attempt to tile the pattern on a shape.
The <pattern> attributes the test-case uses to achieve the above: viewBox='0 0 110 24' width='110' height='24' patternUnits="userSpaceOnUse" patternTransform="rotate(90)"
Actual results:
Firefox renders the pattern blurrier and blurrier as its aspect-ratio diverges from 1:1. Small width/height differences aren't as noticeable, but the rendering approaches "pathological" even with a ratio like 5:1.
This happens on Windows and MacOS on both 1x and 2x reported screen densities, so the issue probably doesn't involve OS APIs.
Expected results:
Chromium and WebKit render the pattern without blurriness. I couldn't find any information in the spec about how this might be a degenerate thing to do with a pattern, so maybe FF is optimizing something it shouldn't?
| Reporter | ||
Comment 1•3 years ago
|
||
Comment 2•3 years ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Graphics: WebRender' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
| Assignee | ||
Updated•3 years ago
|
Comment 3•3 years ago
|
||
Interestingly, if I change the rotation in the codepen example to rotate(45) or similar, the pattern renders quite well. But as the angle nears 90, it definitely gets very rough.
| Assignee | ||
Comment 4•3 years ago
|
||
corrected testcase
Comment 5•3 years ago
|
||
I believe this is happening because of the scaling in this block of code. I've pushed a try job with an experimental patch to improve it; let's see how it looks.
| Assignee | ||
Comment 6•3 years ago
|
||
It's easier than that I think, ConvertToSurfaceSize should just take bbox.Size rather than transformedBBox.Size
Comment 7•3 years ago
•
|
||
I was concerned that wouldn't work so well in cases where the patternTransform is going to substantially enlarge the rendering.
[edit: So for instance, simply using bbox.Size() makes the right-hand example in https://codepen.io/jfkthame/pen/PodXJLy look terrible.]
| Assignee | ||
Comment 8•3 years ago
|
||
we could create such a case and try it I suppose. Here's my blue corner try job to take on your red corner one. I've temporarily removed the fuzziness of all pattern transform reftests to see if we've made progress on those.
| Assignee | ||
Comment 9•3 years ago
|
||
We should do it your way given that testcase but include something like it in our reftests.
| Assignee | ||
Comment 10•3 years ago
|
||
I can fix mine like so... try job
This version displays your testcase and the testcase in the bug without fuzziness
| Assignee | ||
Comment 11•3 years ago
|
||
Updated•3 years ago
|
| Assignee | ||
Comment 12•3 years ago
|
||
I guess 17, 2375 beats 90,5414
| Assignee | ||
Comment 13•3 years ago
|
||
Comment 14•3 years ago
|
||
Comment 15•3 years ago
|
||
Backed out for causing reftest failures on pattern-transformed.
Comment 16•3 years ago
•
|
||
The patch was re-landed. Sorry for any inconvenience caused by this.
Comment 17•3 years ago
|
||
Comment 18•3 years ago
|
||
I was right the first time, this indeed caused reftest failures on pattern-transformed.
Something strange happened with this backfills for this Rs2 job they all turned green and that was the thing that made me re-land the patch thinking I was wrong the first time.
| Assignee | ||
Comment 19•3 years ago
|
||
Comment 20•3 years ago
|
||
Comment 21•3 years ago
|
||
| bugherder | ||
Updated•3 years ago
|
| Assignee | ||
Updated•3 years ago
|
Reproducible on a 2023-03-23 Nightly build on macOS 12.
Verified as fixed on Firefox 113.0(build ID: 20230501151611) and Nightly 114.0a1(build ID: 20230502160708) on macOS 12, Windows 10, Ubuntu 22.
Description
•