Title: [106988] trunk/Source/WebCore
Revision
106988
Author
mdela...@apple.com
Date
2012-02-07 13:52:58 -0800 (Tue, 07 Feb 2012)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=77912
Removing old CG shadow code.
        
A CG-specific shadow offset hack was added in http://trac.webkit.org/changeset/34317
for this particular setShadow method. However, this shadow offset adjustment for CG
has since moved down into platform specific code. Thus, this offset adjustment here
is now redundant.

The CG-only shadow setting code block in this setShadow method is now redundant.
Since it sets the shadow values to the CGContext directly - and not to the State object -
it will be overwritten later by any subsequent calls to setting shadow values such as
blur, offset, or shadow color.

Reviewed by Simon Fraser.

No new tests. Current canvas tests cover this path.

* html/canvas/CanvasRenderingContext2D.cpp:
(WebCore::CanvasRenderingContext2D::setShadow):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106987 => 106988)


--- trunk/Source/WebCore/ChangeLog	2012-02-07 21:52:21 UTC (rev 106987)
+++ trunk/Source/WebCore/ChangeLog	2012-02-07 21:52:58 UTC (rev 106988)
@@ -1,3 +1,25 @@
+2012-02-07  Matthew Delaney  <mdela...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=77912
+        Removing old CG shadow code.
+        
+        A CG-specific shadow offset hack was added in http://trac.webkit.org/changeset/34317
+        for this particular setShadow method. However, this shadow offset adjustment for CG
+        has since moved down into platform specific code. Thus, this offset adjustment here
+        is now redundant.
+
+        The CG-only shadow setting code block in this setShadow method is now redundant.
+        Since it sets the shadow values to the CGContext directly - and not to the State object -
+        it will be overwritten later by any subsequent calls to setting shadow values such as
+        blur, offset, or shadow color.
+
+        Reviewed by Simon Fraser.
+
+        No new tests. Current canvas tests cover this path.
+
+        * html/canvas/CanvasRenderingContext2D.cpp:
+        (WebCore::CanvasRenderingContext2D::setShadow):
+
 2012-02-07  James Robinson  <jam...@chromium.org>
 
         [chromium] Gracefully handle compositor initialization failure in single-threaded proxy

Modified: trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp (106987 => 106988)


--- trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2012-02-07 21:52:21 UTC (rev 106987)
+++ trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp	2012-02-07 21:52:58 UTC (rev 106988)
@@ -1101,26 +1101,6 @@
     didDraw(boundingRect);
 }
 
-#if USE(CG)
-static inline CGSize adjustedShadowSize(CGFloat width, CGFloat height)
-{
-    // Work around <rdar://problem/5539388> by ensuring that shadow offsets will get truncated
-    // to the desired integer.
-    static const CGFloat extraShadowOffset = narrowPrecisionToCGFloat(1.0 / 128);
-    if (width > 0)
-        width += extraShadowOffset;
-    else if (width < 0)
-        width -= extraShadowOffset;
-
-    if (height > 0)
-        height += extraShadowOffset;
-    else if (height < 0)
-        height -= extraShadowOffset;
-
-    return CGSizeMake(width, height);
-}
-#endif
-
 void CanvasRenderingContext2D::setShadow(float width, float height, float blur)
 {
     state().m_shadowOffset = FloatSize(width, height);
@@ -1181,20 +1161,7 @@
     state().m_shadowOffset = FloatSize(width, height);
     state().m_shadowBlur = blur;
     state().m_shadowColor = makeRGBAFromCMYKA(c, m, y, k, a);
-
-    GraphicsContext* dc = drawingContext();
-    if (!dc)
-        return;
-#if USE(CG)
-    const CGFloat components[5] = { c, m, y, k, a };
-    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceCMYK();
-    CGColorRef shadowColor = CGColorCreate(colorSpace, components);
-    CGColorSpaceRelease(colorSpace);
-    CGContextSetShadowWithColor(dc->platformContext(), adjustedShadowSize(width, -height), blur, shadowColor);
-    CGColorRelease(shadowColor);
-#else
     applyShadow();
-#endif
 }
 
 void CanvasRenderingContext2D::clearShadow()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to