WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED INVALID
68899
[CG] Both ShadowBlur and CG Shadow are applied to the rect in GraphicsContext::fillRect()
https://bugs.webkit.org/show_bug.cgi?id=68899
Summary
[CG] Both ShadowBlur and CG Shadow are applied to the rect in GraphicsContext...
Renata Hodovan
Reported
2011-09-27 06:41:02 PDT
Original code: bool drawOwnShadow = !isAcceleratedContext() && hasBlurredShadow(m_state) && !m_state.shadowsIgnoreTransforms; // Don't use ShadowBlur for canvas yet. if (drawOwnShadow) { float shadowBlur = m_state.shadowsUseLegacyRadius ? radiusToLegacyRadius(m_state.shadowBlur) : m_state.shadowBlur; // Turn off CG shadows. CGContextSaveGState(context); CGContextSetShadowWithColor(context, CGSizeZero, 0, 0); ShadowBlur contextShadow(FloatSize(shadowBlur, shadowBlur), m_state.shadowOffset, m_state.shadowColor, m_state.shadowColorSpace); contextShadow.drawRectShadow(this, rect, RoundedRect::Radii()); } CGContextFillRect(context, rect); After some debugging it seems that the shadow applied twice both with ShadowBlur and CGShadow. We halved the rectangle to emphasize this effect: // Was CGContextFillRect(context, rect); FloatRect tmp2 = FloatRect(rect.x() + rect.width() / 4, rect.y() + rect.height() / 4, rect.width() / 2, rect.height() / 2); CGContextFillRect(context, tmp2); We attached two pics. In without_contextShadow.png the drawRectShadow was commented out while it was enabled on with_contextShadow.png. The strange thing was the shadow is still drawn when the drawRectShadow was commented out. Any idea?
Attachments
with_contextShadow.png
(7.63 KB, image/png)
2011-09-27 06:41 PDT
,
Renata Hodovan
no flags
Details
without_contextShadow.png
(5.60 KB, image/png)
2011-09-27 06:42 PDT
,
Renata Hodovan
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Renata Hodovan
Comment 1
2011-09-27 06:41:48 PDT
Created
attachment 108840
[details]
with_contextShadow.png
Renata Hodovan
Comment 2
2011-09-27 06:42:32 PDT
Created
attachment 108841
[details]
without_contextShadow.png
Tim Horton
Comment 3
2011-09-27 15:33:25 PDT
I'm a bit confused. Where's the testcase; how can I reproduce this? Or is this in code you're currently working on? Anyway, how are you applying the shadow? -webkit-svg-shadow? If it's -webkit-svg-shadow, that gets applied via a transparency layer that gets created (in SVGRenderSupport::prepareToRenderSVGContent) whenever you first hit the -webkit-svg-shadow'd element, so each element has no need to draw its own shadow.
Renata Hodovan
Comment 4
2011-09-29 07:16:52 PDT
(In reply to
comment #3
)
> I'm a bit confused. Where's the testcase; how can I reproduce this? Or is this in code you're currently working on?
> Anyway, how are you applying the shadow? -webkit-svg-shadow? If it's -webkit-svg-shadow, that gets applied via a transparency layer that gets created (in SVGRenderSupport::prepareToRenderSVGContent) whenever you first hit the -webkit-svg-shadow'd element, so each element has no need to draw its own shadow.
The test case was a reduced version of svg/css/group-with-shadow.svg. It uses -webkit-svg-shadow property. I faced this problem while I was working on a new renderer for SVGElements which painted with the shape's own painter without path's one. So if I tried to fill a rectangle with the platform dependent fillRect() it applied both of the shadows.
Simon Fraser (smfr)
Comment 5
2011-09-30 10:25:30 PDT
Why is SVG different from CSS here? CSS doesn't have this issue.
Renata Hodovan
Comment 6
2011-09-30 11:03:09 PDT
(In reply to
comment #5
)
> Why is SVG different from CSS here? CSS doesn't have this issue.
I don't know exactly the reason but it seems that doesn't matter if I turn out the shadow drawing it still will be painted. I guess it maybe related to context redirections...
Dirk Schulze
Comment 7
2014-05-12 06:42:09 PDT
rene, could you upload a test case please? Is this still the case?
Simon Fraser (smfr)
Comment 8
2015-12-04 21:24:48 PST
Still need a testcase.
Brent Fulgham
Comment 9
2022-07-15 14:58:40 PDT
It's difficult to confirm this bug without a test case. We don't believe there is an ongoing issue here. If you do feel there is a problem, please REOPEN this bug and include a test case illustrating the issue.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug