From e0933122d8edec55bd98c717b267cc31e69b6b77 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Wed, 25 Sep 2024 11:56:04 +0000 Subject: [PATCH] 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 --- image/SurfacePipeFactory.h | 12 ++++++------ .../test/reftest/downscaling/1919368-1-ref.html | 1 + image/test/reftest/downscaling/1919368-1.avif | Bin 0 -> 1003 bytes image/test/reftest/downscaling/1919368-1.html | 1 + image/test/reftest/downscaling/1919368-1.png | Bin 0 -> 583 bytes image/test/reftest/downscaling/reftest.list | 9 +++++++++ testing/test/test_skipfails.py | 2 +- 7 files changed, 18 insertions(+), 7 deletions(-) create mode 100644 image/test/reftest/downscaling/1919368-1-ref.html create mode 100644 image/test/reftest/downscaling/1919368-1.avif create mode 100644 image/test/reftest/downscaling/1919368-1.html create mode 100644 image/test/reftest/downscaling/1919368-1.png diff --git a/image/SurfacePipeFactory.h b/image/SurfacePipeFactory.h index 2a7824f766d4..144e9bbad2d5 100644 --- a/image/SurfacePipeFactory.h +++ b/image/SurfacePipeFactory.h @@ -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); diff --git a/image/test/reftest/downscaling/1919368-1-ref.html b/image/test/reftest/downscaling/1919368-1-ref.html new file mode 100644 index 000000000000..e425b953d2a0 --- /dev/null +++ b/image/test/reftest/downscaling/1919368-1-ref.html @@ -0,0 +1 @@ + diff --git a/image/test/reftest/downscaling/1919368-1.avif b/image/test/reftest/downscaling/1919368-1.avif new file mode 100644 index 0000000000000000000000000000000000000000..563ea31d77be8d4e4b610e3c5d8ddd5faa8406e8 GIT binary patch literal 1003 zcmZQzU{FXasVqn=%S>Yc0uY^>nP!-qnV9D5Xz0kmz}TCcT9OEo0|JeVl$;_6lYyZi zGr0uD2GKd0Nibvh3NlM_!E%g1QYSMfKN-YxVPIfl0EqxG(|;iS2FM5V7`Fl`FCg0~ zGcynD60nREkdq2h0@9IKW?<-?pOX)E073>R4U%!pDac3!sg%krN`;ufz`&PST9E^` z6J+b*%z~l0rXiDmgQ` zz^b^ixFj{V*b1m7Gbb~#sM0DC=6t!#f?TjafLeip#lpzc%)-FL!pPdj4ivDf zV&Gzz)?2+V{lf~QJxl@&3}4S?)a4(md)l)gX&3Xq1^gQhF}r9!No}==n5w<} zJ~;U4>?IM#ivcMG;s?x@7kSGq;_AF{S+iWX5^-Gx*#RUU&J!O+vUV+K%@f}r;4Rv)=vpPK%=0G=x92aaogW~wdx47o zlh|D=EDo;tenY0cbxo(_+*8+Fdd@w~R&q-(+S;jdDd4f+zQ1k%m&ex~uD`r~zsl^+ z>r)|LGgo>2Pz$>c(-Pjdt!i~N2YwndWecD^Nz{?(-a@GyZ+}tWh!+o;KIp@xJCh{ZSjdy|996V8_#l<6|wPq zqj_}Kw}KbjBffRbE8(15-_bEc$*N!zXI$5=uJ~Bv-JG#vZ00653v6;1- diff --git a/image/test/reftest/downscaling/1919368-1.png b/image/test/reftest/downscaling/1919368-1.png new file mode 100644 index 0000000000000000000000000000000000000000..66e6306c6067af85ba7f942a0aa76dcfb7deffc6 GIT binary patch literal 583 zcmeAS@N?(olHy`uVBq!ia0y~y;QGM8z;c0+87Lxpov8pwu?6^qxB}__4KgORo@ziA zQ%R6tFhj#^Z9fSH2F7=uE{-7;x87bbzEDFaXzzwu(6bz;i_;8cKpov}f@AL>2kh45p{an^LB{Ts5 D#YRM| literal 0 HcmV?d00001 diff --git a/image/test/reftest/downscaling/reftest.list b/image/test/reftest/downscaling/reftest.list index 905176199743..86b42ab3349d 100644 --- a/image/test/reftest/downscaling/reftest.list +++ b/image/test/reftest/downscaling/reftest.list @@ -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 diff --git a/testing/test/test_skipfails.py b/testing/test/test_skipfails.py index 5713c6c6b078..9ee5221e97b4 100644 --- a/testing/test/test_skipfails.py +++ b/testing/test/test_skipfails.py @@ -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():