Translated canvas with transformed pattern not drawn
Categories
(Core :: Graphics: Canvas2D, defect, P3)
Tracking
()
Tracking | Status | |
---|---|---|
firefox93 | --- | fixed |
People
(Reporter: bdahl, Assigned: lsalzman)
References
(Depends on 1 open bug)
Details
Attachments
(4 files)
A canvas that has translated coordinates outside of the canvas bounds fails to draw a pattern that has a transform that should move the pattern back into the canvas bounds.
Overview of the test case:
Translate the canvas y
100 so is out of bounds. Create a non repeating pattern that uses a setTransform that reverses the y
translation. Fill the canvas with the pattern.
STR
- Open attached example
Expected:
There should be a red square drawn in the top-left corner of the main canvas.
Actual:
Nothing is drawn
Reporter | ||
Comment 1•3 years ago
|
||
Reporter | ||
Comment 2•3 years ago
|
||
Updated•3 years ago
|
Updated•3 years ago
|
Updated•3 years ago
|
Assignee | ||
Comment 3•3 years ago
|
||
It seems like this code is causing the problem: https://searchfox.org/mozilla-central/source/dom/canvas/CanvasRenderingContext2D.cpp#2580
Assignee | ||
Comment 4•3 years ago
|
||
This is a bandaid designed to cope with a subset of the encountered transforms that
may be applied to a pattern inside FillRect. The existing code did not consider the
transform at all that might be applied to a pattern when it tried to manually clip
the geometry to a no-repeat pattern.
This manual clipping only seems to occur in FillRect, whereas no-repeat patterns
are not properly handled anywhere else in canvas entry-points. To fix this more
generally requires a clamp-to-transparent tile mode (like Skia's decal or Cairo's
none) which we can't currently rely upon with our D2D support. However, that is
much beyond the scope of this temporary workaround.
Updated•3 years ago
|
Pushed by lsalzman@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/ffc7756de047 Support translated no-repeat patterns in canvas FillRect. r=jrmuizel
Comment 6•3 years ago
|
||
bugherder |
Description
•