canvas composition ops not working correctly with emoji filltext
Categories
(Core :: Graphics: Canvas2D, defect)
Tracking
()
People
(Reporter: axkibe, Assigned: jfkthame)
Details
Attachments
(7 files)
406 bytes,
text/html
|
Details | |
1.17 KB,
text/html
|
Details | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
309.58 KB,
image/png
|
Details | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-esr128+
|
Details | Review |
48 bytes,
text/x-phabricator-request
|
phab-bot
:
approval-mozilla-esr128+
|
Details | Review |
Steps to reproduce:
Open following minimal example
<html>
<script>
window.onload = ( ) => {
const cv = document.getElementById('canvas');
const cx = cv.getContext('2d');
cx.fillStyle='#888888';
cx.fillRect(0,0,200,200);
cx.globalCompositeOperation='destination-in';
cx.fillStyle='black';
cx.font = '200px sans-serif';
cx.fillText('\u{1F63A}',40,180);
};
</script>
<body>
<canvas id="canvas" width="200" height="200"></canvas>
</body>
</html>
Actual results:
canvas is blank.
Expected results:
a gray cat to be visible (as in chromium). Purpose removing the color from the color emoji.
This can be worked around by just drawing the emoji first using source-over in another off screen canvas and using that for drawImage( ) using destionation-out composite.
I get this is extremely important and a totally common usecase :) Anyway, could be fixed, albeit I worked around it.
Comment 1•5 months ago
|
||
The Bugbug bot thinks this bug should belong to the 'Core::Graphics: Canvas2D' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.
Comment 2•5 months ago
|
||
Updated•5 months ago
|
Comment 3•5 months ago
•
|
||
Bisection:
https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=9b23d1bb84b2499b94d91c5f588fc93a54e5bdcc&tochange=3c9ae13132f0e2c2fe2841422bd316ce6af1b823
Maybe bug 1746795 ?
Before the bisection: full cat emoji is drawn
After bisection: blank page
Improvement1: https://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=8aca58bfd700721a1d20f1de5b04eecbb64fb3e2&tochange=a4e2776e87186593dfcd3984fd61df789f5e51be - A inverted "L" shape is drawnn
Improvement2:
1875670 - Add a cache for rasterized COLRv1 glyphs, because fully redrawing them on each use can be expensive. r=gfx-reviewers,lsalzman
Differential Revision: https://phabricator.services.mozilla.com/D200139
-> After this, a grey square is drawn.
Looks like a Text+camvas bug.
Comment 4•4 months ago
|
||
The severity field is not set for this bug.
:lsalzman, could you have a look please?
For more information, please visit BugBot documentation.
Comment 5•4 months ago
|
||
Jonathan, this seems like maybe the various layers of the glyph are just compositing strangely here? What would be the correct interpretation here?
Assignee | ||
Updated•4 months ago
|
Assignee | ||
Comment 6•4 months ago
|
||
This actually affects pretty much all the composition operators, though it's more glaringly wrong with some than others. The attached testcase exercises more of them.
Assignee | ||
Updated•4 months ago
|
Assignee | ||
Comment 7•4 months ago
|
||
Assignee | ||
Comment 8•4 months ago
|
||
This shows the rendering of the above testcase using current Nightly (left) vs a build with the patch (right), where compositing works correctly.
Updated•4 months ago
|
Assignee | ||
Comment 9•4 months ago
|
||
Comment 10•4 months ago
|
||
Comment 12•4 months ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/7d1990e74b44
https://hg.mozilla.org/mozilla-central/rev/c2d7979b2ae3
Assignee | ||
Comment 14•3 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D215408
Updated•3 months ago
|
Assignee | ||
Comment 15•3 months ago
|
||
Original Revision: https://phabricator.services.mozilla.com/D215475
Updated•3 months ago
|
Comment 16•3 months ago
|
||
esr128 Uplift Approval Request
- User impact if declined: bad rendering of color glyphs, depending on compositing modes; pre-req for uplift of bug 1912431
- Code covered by automated testing: yes
- Fix verified in Nightly: yes
- Needs manual QE test: no
- Steps to reproduce for manual QE testing: n/a
- Risk associated with taking this patch: low
- Explanation of risk level: fix affects only color-glyph painting code, has test coverage
- String changes made/needed: none
- Is Android affected?: yes
Updated•3 months ago
|
Updated•3 months ago
|
Comment 17•3 months ago
|
||
uplift |
Updated•3 months ago
|
Description
•