[Webkit-unassigned] [Bug 108897] [Cairo] Canvas-shadow behavior is not being as expected

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 1 22:59:49 PDT 2013


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





--- Comment #23 from Rashmi Shyamasundar <rashmi.s2 at samsung.com>  2013-04-01 22:57:59 PST ---
Question:. Why should the extend mode be "CAIRO_EXTEND_NONE"?
Ans: As described in the cairo manual,
http://cairographics.org/manual/cairo-cairo-pattern-t.html#cairo-extend-t :

"The default extend mode is CAIRO_EXTEND_NONE for surface patterns and CAIRO_EXTEND_PAD for gradient patterns."

In the function PlatformContextCairo::drawSurfaceToContext(), a pattern is being created from the source surface and this pattern is drawn onto the destination context. There is no gradient involved. Hence the extend mode for filling the pattern should be "CAIRO_EXTEND_NONE".

This does not add any regression.

There is already a layout-test highlighting this issue -
fast/canvas/canvas-createPattern-fillRect-shadow.html

In this test case, without this patch, the "shadowColor"(red) mentioned in html, will be seen in the original image on canvas, wherever the image is transparent.
With this patch, this issue is solved.

The steps used for drawing a shadow is - 

1. Create a cairo surface/context called shadow-context and set this context to translate to shadowOffsetX and shadowOffsetY. Draw the original image on the shadow-context. 

The translation is handled in ShadowBlur::beginShadowLayer(). Drawing the original image on the context is done in drawPathShadow() in GraphicsContextCairo.cpp. 

2. Fill the shadow-context with "shadowColor", by setting the global composite operator to be "CompositeSourceIn". This will ulitmately result in changing the color of the image in shadowContext(destination image), to shadowColor. This is done in ShadowBlur::blurAndColorShadowBuffer().

3. Copy the shadow-context to the original canvas-context, using the global composite operator - "CompositeSourceOver".

Root cause for the issue:-

In step #2, while filling the shadow-context with "shadowColor", if we use the extend mode "CAIRO_EXTEND_PAD" in PlatformContextCairo::drawSurfaceToContext(), the original image area is also filled with the shadowColor.

-- 
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