зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1912431 - Don't apply global alpha when creating a cached color glyph. r=gfx-reviewers,lsalzman
The reftest here currently fails on Android for what appears to be an unrelated reason: reftest-analyzer shows that in the *reference* case, all but the last line of text is completely missing. I'm not sure what's failing there (but it fails similarly without this patch, anyhow); we should investigate that as a separate bug. Differential Revision: https://phabricator.services.mozilla.com/D219024
This commit is contained in:
Родитель
ddf3ec5052
Коммит
87af13246d
|
@ -0,0 +1,31 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en" >
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<style>
|
||||||
|
canvas { display: block; }
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
function createCanvas(alpha) {
|
||||||
|
const canvas = document.createElement("canvas");
|
||||||
|
canvas.width = 500;
|
||||||
|
canvas.height = 50;
|
||||||
|
canvas.style.opacity = alpha;
|
||||||
|
|
||||||
|
document.body.appendChild(canvas);
|
||||||
|
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
ctx.font = "20px Arial";
|
||||||
|
ctx.fillText("Text: ABC, Clocks: \ud83d\udd52 \ud83d\udd53 \ud83d\udd54 \ud83d\udd55.", 50, 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
createCanvas(0);
|
||||||
|
createCanvas(0.25);
|
||||||
|
createCanvas(0.5);
|
||||||
|
createCanvas(0.75);
|
||||||
|
createCanvas(1);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -0,0 +1,30 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en" >
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const canvas = document.createElement("canvas");
|
||||||
|
canvas.width = 500;
|
||||||
|
canvas.height = 300;
|
||||||
|
|
||||||
|
document.body.appendChild(canvas);
|
||||||
|
|
||||||
|
const ctx = canvas.getContext('2d');
|
||||||
|
ctx.font = "20px Arial";
|
||||||
|
|
||||||
|
function createLabel(alpha) {
|
||||||
|
ctx.globalAlpha = alpha;
|
||||||
|
ctx.fillText("Text: ABC, Clocks: \ud83d\udd52 \ud83d\udd53 \ud83d\udd54 \ud83d\udd55.", 50, 30 + 200 * alpha);
|
||||||
|
}
|
||||||
|
|
||||||
|
createLabel(0);
|
||||||
|
createLabel(0.25);
|
||||||
|
createLabel(0.5);
|
||||||
|
createLabel(0.75);
|
||||||
|
createLabel(1);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
|
@ -47,4 +47,4 @@ fuzzy-if(!winWidget,0-1,0-4) fuzzy-if(winWidget,14-14,245-314) == 1853216-1.html
|
||||||
fuzzy-if(winWidget,0-1,0-13) == 1873708-emoji-canvas-filter.html 1873708-emoji-canvas-filter-ref.html
|
fuzzy-if(winWidget,0-1,0-13) == 1873708-emoji-canvas-filter.html 1873708-emoji-canvas-filter-ref.html
|
||||||
!= 1870240-colrv1-cycle.html 1870240-colrv1-cycle-notref.html
|
!= 1870240-colrv1-cycle.html 1870240-colrv1-cycle-notref.html
|
||||||
== 1909933.html 1909933-ref.html
|
== 1909933.html 1909933-ref.html
|
||||||
|
fuzzy-if(cocoaWidget||winWidget,0-2,0-3738) fails-if(Android) == 1912431-emoji-globalAlpha.html 1912431-emoji-globalAlpha-ref.html
|
||||||
|
|
|
@ -2730,9 +2730,10 @@ bool gfxFont::RenderColorGlyph(DrawTarget* aDrawTarget, gfxContext* aContext,
|
||||||
RefPtr target =
|
RefPtr target =
|
||||||
Factory::CreateDrawTarget(BackendType::SKIA, size, format);
|
Factory::CreateDrawTarget(BackendType::SKIA, size, format);
|
||||||
if (target) {
|
if (target) {
|
||||||
// Use OP_OVER to create the glyph snapshot.
|
// Use OP_OVER and opaque alpha to create the glyph snapshot.
|
||||||
DrawOptions drawOptions(aFontParams.drawOptions);
|
DrawOptions drawOptions(aFontParams.drawOptions);
|
||||||
drawOptions.mCompositionOp = CompositionOp::OP_OVER;
|
drawOptions.mCompositionOp = CompositionOp::OP_OVER;
|
||||||
|
drawOptions.mAlpha = 1.0f;
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
if (paintGraph) {
|
if (paintGraph) {
|
||||||
ok = COLRFonts::PaintGlyphGraph(
|
ok = COLRFonts::PaintGlyphGraph(
|
||||||
|
|
Загрузка…
Ссылка в новой задаче