Issue 14627 in skia: CPU Backend: Color filter applied to opaque shader with paint alpha is incorrect

1 view
Skip to first unread message

brian… via monorail

unread,
Jul 18, 2023, 11:42:31 AM7/18/23
to bu...@skia.org
Status: Accepted
Owner: brian...@google.com
Priority: Medium
Type: Defect

New issue 14627 by brian...@google.com: CPU Backend: Color filter applied to opaque shader with paint alpha is incorrect
https://bugs.chromium.org/p/skia/issues/detail?id=14627

Trivial repro case: https://fiddle.skia.org/c/cf5ba8db0127c238e362348100869935

This is a bug in SkColorFilterShader, which is used to simplify the paint for the CPU backend. That class turns the color filter into a wrapper shader that invokes the original paint shader, then applies paint alpha, and then invokes the color filter. However, when it calls the color filter, the argument for 'shaderIsOpaque' is only determined by the shader, not the paint alpha. This means that with an opaque shader, paint alpha, and a color filter, the color filter gets an incorrect value for shaderIsOpaque. Many (most) color filters operate on unpremul colors, and use that bool to skip doing an unpremul/premul pair - producing different results.

--
You received this message because:
1. The project was configured to send all issue notifications to this address

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

Git Watcher via monorail

unread,
Jul 18, 2023, 1:06:27 PM7/18/23
to bu...@skia.org

Comment #1 on issue 14627 by Git Watcher: CPU Backend: Color filter applied to opaque shader with paint alpha is incorrect
https://bugs.chromium.org/p/skia/issues/detail?id=14627#c1

The following revision refers to this bug:
https://skia.googlesource.com/skia/+/4e518e65fea051eb148e8078bfce88c72aeb6c6d

commit 4e518e65fea051eb148e8078bfce88c72aeb6c6d
Author: Brian Osman <brian...@google.com>
Date: Tue Jul 18 15:48:52 2023

CPU backend: Don't ignore paint alpha with opaque shader + color filter

Bug: skia:14627
Change-Id: I34391f789e59edff01253e0853b820ceb6a306bf
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/725696
Reviewed-by: John Stiles <johns...@google.com>
Commit-Queue: Brian Osman <brian...@google.com>

[modify] https://crrev.com/4e518e65fea051eb148e8078bfce88c72aeb6c6d/src/shaders/SkColorFilterShader.cpp
[modify] https://crrev.com/4e518e65fea051eb148e8078bfce88c72aeb6c6d/gm/colorfilters.cpp

brian… via monorail

unread,
Jul 18, 2023, 1:06:56 PM7/18/23
to bu...@skia.org
Updates:
Status: Fixed

Comment #2 on issue 14627 by brian...@google.com: CPU Backend: Color filter applied to opaque shader with paint alpha is incorrect
https://bugs.chromium.org/p/skia/issues/detail?id=14627#c2

(No comment was entered for this change.)

Git Watcher via monorail

unread,
Jul 20, 2023, 3:57:07 PM7/20/23
to bu...@skia.org

Comment #3 on issue 14627 by Git Watcher: CPU Backend: Color filter applied to opaque shader with paint alpha is incorrect
https://bugs.chromium.org/p/skia/issues/detail?id=14627#c3


The following revision refers to this bug:
https://skia.googlesource.com/skia/+/303245328527a281a603fa92acceb78d620efdb9

commit 303245328527a281a603fa92acceb78d620efdb9
Author: Brian Osman <brian...@google.com>
Date: Thu Jul 20 18:15:39 2023

Convert recently added GM to unit test

Bug: skia:14627
Change-Id: Ia0c199bca345d92cb0318426216877f9242c2050
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/727078
Reviewed-by: Robert Phillips <robertp...@google.com>
Commit-Queue: Brian Osman <brian...@google.com>

[modify] https://crrev.com/303245328527a281a603fa92acceb78d620efdb9/gm/colorfilters.cpp
[modify] https://crrev.com/303245328527a281a603fa92acceb78d620efdb9/tests/ColorFilterTest.cpp
Reply all
Reply to author
Forward
0 new messages