Fix alpha bleeding when smooth-scaling images#10528
Conversation
ogoffart
left a comment
There was a problem hiding this comment.
Premultiplied is probably the right format to store the cached rendered image. But while this works for image loaded from file, it would still be a problem for image created by the user with the ARGB (not premultiplied) format.
Yeah, I was thinking the same. But at least there folks have a choice :) |
ec6a7fd to
a8ab43b
Compare
|
Could we have a screenshot test with an image that highlights the wrong behavior? |
That turns out to be rather difficult, given that already the smooth scaling with pre-multiplied alpha seems to result in differences with skia :-( |
a8ab43b to
48ca77f
Compare
|
I'm trying a new PR that disables the smooth scaling for these tests - which also sucks :-( |
Ah oops. This might be why some test were skipped before: slint/tests/screenshots/cases/image/images.slint Lines 5 to 6 in 5c21a83 (and more tests have that) We could of course skip more tests but that'd be unfortunate. Or have different threshold for skia. |
Ah good idea. |
a0d1aa5 to
034951b
Compare
After loading for example PNGs with an alpha, prefer passing it to renderers as pre-multiplied alpha, so that nearby transparent pixels (r=g=b=a=0) don't contribute anything as pre-multiplication will zero out their r/g/b. Fixes #10469 For the screenshot tests, smooth scaling is disabled because it results in different rendering between macOS and Linux on Skia with pre-multiplied alpha.
034951b to
36b83e7
Compare
After loading for example PNGs with an alpha, prefer passing it to renderers as pre-multiplied alpha, so that nearby transparent pixels (r=g=b=a=0) don't contribute anything as pre-multiplication will zero out their r/g/b.
Fixes #10469