[Webkit-unassigned] [Bug 23526] clipToImageBuffer() for all platforms

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jun 23 12:19:44 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=23526


Andrei Bucur <abucur at adobe.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |abucur at adobe.com




--- Comment #9 from Andrei Bucur <abucur at adobe.com>  2010-06-23 12:19:44 PST ---
The original email from webkit-dev:
"I'm trying to implement this CSS value on the Cairo backend and I'm stuck with a problem regarding the Porter-Duff composition operators (why is CAIRO_OPERATOR_DEST_IN unbound?). I've made the following changes to reach this point:

1. I implemented a version of GraphicsContext::clipToImageBuffer starting from this patch: https://bugs.webkit.org/show_bug.cgi?id=23526 , but saving the image mask and the masking rect on a stack and pushing only a group for the masked content.
2. In GraphicsContext::restorePlatformState when the save count is 0 for the current mask, I recover the masked content as a pattern, I clip it using the mask from the stack (I used a new group and operator CAIRO_OPERATOR_IN) and then I should apply the result on the destination surface using CAIRO_OPERATOR_DEST_IN, but bounded to the current mask. The problem here is that CAIRO_OPERATOR_DEST_IN is unbounded so it doesn't take into account the mask, thus affecting all the surface.
3. I modify RenderBoxModelObject::paintFillLayerExtended so that when drawing the background image to use the bgLayer->composite() operator if the clip is TextFillBox. Using CompositeSourceIn can't work because clipToImageBuffer started a new group which uses a different surface for drawing (so there is no destination text to composite with). This way the composition will be done in restorePlatformState.

I know this is ugly and that it's highly unlikely to work in this form with SVG masking. For now I just need a hook to make this work. Do you have any other suggestions to make this CSS value work with Cairo?"

This is the rendering path I discovered for "-webkit-mask-clip: text" and why it doesn't work with this Cairo patch:

1. The text is rendered on the destination surface.
2. In PaintPhaseMask the filling is achieved using RenderBoxModelObject::paintFillLayerExtended with bgLayer->clip() == TextFillBox. The text is re-rendered in an image to be used a mask for the background. By calling clipToImageBuffer this image is painted on a new group and another one is also pushed for the masked image.
3. When drawing the background, the composite operator used is an IN kind. This operator needs to have the text rendered on the destination surface. By pushing a new group in the previous step, the destination surface becomes empty so the IN operator can't work properly. In the end the background is not painted.

I have attached an example. The result should be green text with white gradient stripes (masked by that .png) on red background.

Andrei.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list