RESOLVED FIXED Bug 84197
[Chromium] Solid color layers should respect opacity value.
https://bugs.webkit.org/show_bug.cgi?id=84197
Summary [Chromium] Solid color layers should respect opacity value.
David Reveman
Reported 2012-04-17 14:56:18 PDT
Fold opacity into shader color for solid color layers.
Attachments
Patch (4.29 KB, patch)
2012-04-17 14:58 PDT, David Reveman
no flags
Patch (4.30 KB, patch)
2012-04-17 16:08 PDT, David Reveman
no flags
Patch (4.23 KB, patch)
2012-04-18 15:30 PDT, David Reveman
no flags
David Reveman
Comment 1 2012-04-17 14:58:11 PDT
Antoine Labour
Comment 2 2012-04-17 15:05:51 PDT
I would do the folding into LayerRendererChromium::drawSolidColorQuad instead. It's intrinsically linked with the shader - e.g. if we were to change the shader to explicitly take the opacity as a param, that's where we'd do it.
James Robinson
Comment 3 2012-04-17 15:19:33 PDT
Comment on attachment 137611 [details] Patch I agree with Antoine.
David Reveman
Comment 4 2012-04-17 16:07:14 PDT
(In reply to comment #2) > I would do the folding into LayerRendererChromium::drawSolidColorQuad instead. It's intrinsically linked with the shader - e.g. if we were to change the shader to explicitly take the opacity as a param, that's where we'd do it. Good point. That also gets rid of the ugly rounding code I have in the current patch.
David Reveman
Comment 5 2012-04-17 16:08:07 PDT
Antoine Labour
Comment 6 2012-04-17 16:13:35 PDT
Comment on attachment 137627 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=137627&action=review > Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp:623 > + GLC(context(), context()->uniform4f(solidColorProgram->fragmentShader().colorLocation(), color.red() / 255.0, color.green() / 255.0, color.blue() / 255.0, (color.alpha() / 255.0) * opacity)); Don't you need to apply opacity to all components, since we're doing premultiplied alpha? All other shaders multiply all components by the opacity.
David Reveman
Comment 7 2012-04-17 16:57:58 PDT
(In reply to comment #6) > (From update of attachment 137627 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=137627&action=review > > > Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp:623 > > + GLC(context(), context()->uniform4f(solidColorProgram->fragmentShader().colorLocation(), color.red() / 255.0, color.green() / 255.0, color.blue() / 255.0, (color.alpha() / 255.0) * opacity)); > > Don't you need to apply opacity to all components, since we're doing premultiplied alpha? All other shaders multiply all components by the opacity. The solid color shader doesn't expect premultiplied alpha. We expect textures to have premultiplied alpha but I'm not sure what the case is for LayerChromium::setBackgroundColor(). If it needs to be fixed, lets do that in a separate patch.
Antoine Labour
Comment 8 2012-04-17 17:04:26 PDT
OK, NVM, the shader already multiplies RGB by A. So this LGTM.
Adrienne Walker
Comment 9 2012-04-18 11:26:31 PDT
Comment on attachment 137627 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=137627&action=review Oops. Thanks for fixing this. R=me. > Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp:104 > + EXPECT_EQ(opacity, quadCuller.quadList()[0]->toSolidColorDrawQuad()->opacity()); This test would have passed before, but I guess there's no reason not to add it.
David Reveman
Comment 10 2012-04-18 11:33:42 PDT
Will rebase and land this patch after: https://bugs.webkit.org/show_bug.cgi?id=84215
David Reveman
Comment 11 2012-04-18 15:30:54 PDT
Created attachment 137786 [details] Patch Rebase
WebKit Review Bot
Comment 12 2012-04-18 16:33:00 PDT
Comment on attachment 137786 [details] Patch Clearing flags on attachment: 137786 Committed r114580: <http://trac.webkit.org/changeset/114580>
WebKit Review Bot
Comment 13 2012-04-18 16:33:05 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.