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 b80e5796b9
commit e0933122d8
7 changed files with 18 additions and 7 deletions

View File

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

View File

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 1003 B

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. # Test downscaling a JPEG with orientation metadata.
fuzzy(0-1,0-50) == downscale-orient.html downscale-orient-ref.html 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: # RUN TESTS WITH DOWNSCALE-DURING-DECODE ENABLED:
# =============================================== # ===============================================
defaults pref(image.downscale-during-decode.enabled,true) 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,100,100 huge-1.html?100x100.jpg,100,100
== huge-1.html?32768x100.jpg,32768,100 huge-1.html?100x100.jpg,32768,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 # Only need to run these with downscaling on
!= 1421191-1.html about:blank != 1421191-1.html about:blank
== 1404366-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( lineno = sf.reftest_find_lineno(
"image/test/reftest/downscaling/reftest.list", mods, allmods "image/test/reftest/downscaling/reftest.list", mods, allmods
) )
assert lineno == 177 assert lineno == 183
def test_reftest_get_lineno3(): def test_reftest_get_lineno3():