Description
Original report by Anonymous.
Original issue 584 created by [email protected] on 2012-04-27T12:16:49.000Z:
What steps will reproduce the problem?
- set m_bTransparentPainting to true
- load up a html page with some transparent elements (preferably white)
- render offscreen output against a bright background (so it gets obvious)
or
use cefclient integrated Off-Screen Rendering test with attached sample HTML file
What is the expected output? What do you see instead?
the alpha channel is correct. however not the RGB colors will appear as if pre-rendered against a black background before actual alpha channel is applied.
so if you got a white transparent pixel with r255 g255 b255 a127 it outputs as r127 g127 b127 a127 in the buffer.
a white transparent box would appear greyish, instead of white
I have attached three files:
test.html - the file i have tested with in cefclient.exe from revision 533 and my actual project.
actualoutput.png - the test.html file loaded in the Off-Screen Rendering App Example of cefclient.exe resulting in a greyish appearance
comparison.png - the same as "actualoutput.png" but with a transparent white Box overlay made with a graphics program for comparison
What version of the product are you using? On what operating system?
I am currently using the Delphi Wrapper of chromiumembedded (http://code.google.com/p/delphichromiumembedded/) which currently uses the older CEF 1.963.439. However i made tests with the cefclient from the current revision 533.
Activity
magreenblatt commentedon May 18, 2012
Comment 1. originally posted by magreenblatt on 2012-05-18T22:22:42.000Z:
magreenblatt commentedon May 18, 2012
magreenblatt commentedon May 23, 2012
Comment 2. originally posted by magreenblatt on 2012-05-23T17:40:30.000Z:
Revision 643 improves the cefclient transparency test by adding the ability to view individual pixel values.
magreenblatt commentedon May 24, 2012
Comment 3. originally posted by magreenblatt on 2012-05-24T18:16:31.000Z:
Transparent painting in WebKit works as follows:
GraphisContext::beginTransparencyLayer creates a new layer (bitmap) for the transparent region.
Painting is done on the new layer using just RGB values.
GraphicsContext::endTransparencyLayer is called to paint the new layer onto the underlying layer and apply the alpha component at the same time.
The call stack for comment 3. is as follows:
So, in conclusion, the S32A_Blend_BlitRow32_SSE2 function intentionally applies alpha blending to all 4 components of the RGBA value.
magreenblatt commentedon May 24, 2012
Comment 4. originally posted by magreenblatt on 2012-05-24T18:44:19.000Z:
For example, in S32A_Blend_BlitRow32_SSE2:
alpha = 0xbf
src_pixel = 0xffffffffffffffffffffffffffffffff (new/transparent layer)
dst_pixel = 0000000000000000000000000000000000 (bb) (underlying layer)
result = 0xbfbfbfbfbfbfbfbfbfbfbfbfbfbfbfbf
magreenblatt commentedon May 24, 2012
Comment 5. originally posted by magreenblatt on 2012-05-24T20:58:48.000Z:
Related skia issue: http://code.google.com/p/skia/issues/detail?id=547
magreenblatt commentedon May 24, 2012
Comment 6. originally posted by magreenblatt on 2012-05-24T21:23:30.000Z:
Started a thread about this on the skia-discuss mailing list: http://groups.google.com/group/skia-discuss/browse\_thread/thread/b15e9eddda5fe021
magreenblatt commentedon May 24, 2012
Original comment by Anonymous.
Comment 7. originally posted by [email protected] on 2012-05-24T22:50:37.000Z:
good you found a lead. i suspected that it is nothing that comes from cef itself. thanks for your dedication in this project :)
magreenblatt commentedon May 25, 2012
Original comment by Anonymous.
Comment 8. originally posted by [email protected] on 2012-05-25T12:19:48.000Z:
Skia writes premultpilied alpha. That's the only pixel format you're going to get out of Chromium.
magreenblatt commentedon May 25, 2012
Comment 9. originally posted by magreenblatt on 2012-05-25T14:24:00.000Z:
Revision 648 updates the cefclient example to account for premultiplied alpha values.
magreenblatt commentedon May 25, 2012
magreenblatt commentedon May 25, 2012
Original comment by Anonymous.
Comment 10. originally posted by [email protected] on 2012-05-25T14:25:58.000Z:
Ahh, I was wondering if it was a question of blend functions. Nice clean fix.
magreenblatt commentedon May 25, 2012
Comment 11. originally posted by magreenblatt on 2012-05-25T14:35:49.000Z:
The cefclient changes have been merged to all branches in revision 649.
Merge revision 643 and revision 648 changes:
Merge revision 643 and revision 648 changes:
Merge revision 643 and revision 648 changes: