Bug 1919368. When constructing surface pipes for images downscaling must come after premultiplying alpha. r=gfx-reviewers,nical

The downscaling filter depends on operating on premultiplied alpha data.

Differential Revision: https://phabricator.services.mozilla.com/D222597
This commit is contained in:
Timothy Nikkel 2024-09-25 11:56:04 +00:00
parent 8b1b75c739
commit 36a27965fb
7 changed files with 18 additions and 7 deletions

View File

@ -637,8 +637,8 @@ class SurfacePipeFactory {
if (aOrientation.IsIdentity()) {
if (colorManagement) {
if (downscale) {
pipe = MakePipe(downscalingConfig, colorManagementConfig,
premultiplyConfig, surfaceConfig);
pipe = MakePipe(colorManagementConfig, premultiplyConfig,
downscalingConfig, surfaceConfig);
} else { // (downscale is false)
pipe = MakePipe(colorManagementConfig, premultiplyConfig,
surfaceConfig);
@ -646,7 +646,7 @@ class SurfacePipeFactory {
} else { // (colorManagement is false)
if (downscale) {
pipe =
MakePipe(downscalingConfig, premultiplyConfig, surfaceConfig);
MakePipe(premultiplyConfig, downscalingConfig, surfaceConfig);
} else { // (downscale is false)
pipe = MakePipe(premultiplyConfig, surfaceConfig);
}
@ -654,15 +654,15 @@ class SurfacePipeFactory {
} else { // (orientation is not identity)
if (colorManagement) {
if (downscale) {
pipe = MakePipe(downscalingConfig, colorManagementConfig,
premultiplyConfig, reorientSurfaceConfig);
pipe = MakePipe(colorManagementConfig, premultiplyConfig,
downscalingConfig, reorientSurfaceConfig);
} else { // (downscale is false)
pipe = MakePipe(colorManagementConfig, premultiplyConfig,
reorientSurfaceConfig);
}
} else { // (colorManagement is false)
if (downscale) {
pipe = MakePipe(downscalingConfig, premultiplyConfig,
pipe = MakePipe(premultiplyConfig, downscalingConfig,
reorientSurfaceConfig);
} else { // (downscale is false)
pipe = MakePipe(premultiplyConfig, reorientSurfaceConfig);

View File

@ -0,0 +1 @@
<img src="1919368-1.png" style="width: 700px; height: 308px;">

Binary file not shown.

View File

@ -0,0 +1 @@
<img src="1919368-1.avif" style="width: 700px; height: 308px;">

Binary file not shown.

After

Width:  |  Height:  |  Size: 583 B

View File

@ -110,6 +110,12 @@ fuzzy(0-1,0-1024) == downscale-32px.html?.jpg downscale-32px-ref.html
# Test downscaling a JPEG with orientation metadata.
fuzzy(0-1,0-50) == downscale-orient.html downscale-orient-ref.html
# be careful changing fuzzy, the bug this test is testing is if the shade of orange is too dark
fuzzy(0-1,0-144) == 1919368-1.html 1919368-1-ref.html
# RUN TESTS WITH DOWNSCALE-DURING-DECODE ENABLED:
# ===============================================
defaults pref(image.downscale-during-decode.enabled,true)
@ -212,6 +218,9 @@ fuzzy(0-4,0-18) == downscale-orient.html downscale-orient-ref.html
== huge-1.html?32768x100.jpg,100,100 huge-1.html?100x100.jpg,100,100
== huge-1.html?32768x100.jpg,32768,100 huge-1.html?100x100.jpg,32768,100
# be careful changing fuzzy, the bug this test is testing is if the shade of orange is too dark
fuzzy(0-1,0-144) == 1919368-1.html 1919368-1-ref.html
# Only need to run these with downscaling on
!= 1421191-1.html about:blank
== 1404366-1.html about:blank

View File

@ -911,7 +911,7 @@ def test_reftest_get_lineno2():
lineno = sf.reftest_find_lineno(
"image/test/reftest/downscaling/reftest.list", mods, allmods
)
assert lineno == 177
assert lineno == 183
def test_reftest_get_lineno3():