Changeset 106988 in webkit


Ignore:
Timestamp:
Feb 7, 2012 1:52:58 PM (12 years ago)
Author:
mdelaney@apple.com
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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106986 r106988  
     12012-02-07  Matthew Delaney  <mdelaney@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=77912
     4        Removing old CG shadow code.
     5       
     6        A CG-specific shadow offset hack was added in http://trac.webkit.org/changeset/34317
     7        for this particular setShadow method. However, this shadow offset adjustment for CG
     8        has since moved down into platform specific code. Thus, this offset adjustment here
     9        is now redundant.
     10
     11        The CG-only shadow setting code block in this setShadow method is now redundant.
     12        Since it sets the shadow values to the CGContext directly - and not to the State object -
     13        it will be overwritten later by any subsequent calls to setting shadow values such as
     14        blur, offset, or shadow color.
     15
     16        Reviewed by Simon Fraser.
     17
     18        No new tests. Current canvas tests cover this path.
     19
     20        * html/canvas/CanvasRenderingContext2D.cpp:
     21        (WebCore::CanvasRenderingContext2D::setShadow):
     22
    1232012-02-07  James Robinson  <jamesr@chromium.org>
    224
  • trunk/Source/WebCore/html/canvas/CanvasRenderingContext2D.cpp

    r106973 r106988  
    11021102}
    11031103
    1104 #if USE(CG)
    1105 static inline CGSize adjustedShadowSize(CGFloat width, CGFloat height)
    1106 {
    1107     // Work around <rdar://problem/5539388> by ensuring that shadow offsets will get truncated
    1108     // to the desired integer.
    1109     static const CGFloat extraShadowOffset = narrowPrecisionToCGFloat(1.0 / 128);
    1110     if (width > 0)
    1111         width += extraShadowOffset;
    1112     else if (width < 0)
    1113         width -= extraShadowOffset;
    1114 
    1115     if (height > 0)
    1116         height += extraShadowOffset;
    1117     else if (height < 0)
    1118         height -= extraShadowOffset;
    1119 
    1120     return CGSizeMake(width, height);
    1121 }
    1122 #endif
    1123 
    11241104void CanvasRenderingContext2D::setShadow(float width, float height, float blur)
    11251105{
     
    11821162    state().m_shadowBlur = blur;
    11831163    state().m_shadowColor = makeRGBAFromCMYKA(c, m, y, k, a);
    1184 
    1185     GraphicsContext* dc = drawingContext();
    1186     if (!dc)
    1187         return;
    1188 #if USE(CG)
    1189     const CGFloat components[5] = { c, m, y, k, a };
    1190     CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceCMYK();
    1191     CGColorRef shadowColor = CGColorCreate(colorSpace, components);
    1192     CGColorSpaceRelease(colorSpace);
    1193     CGContextSetShadowWithColor(dc->platformContext(), adjustedShadowSize(width, -height), blur, shadowColor);
    1194     CGColorRelease(shadowColor);
    1195 #else
    11961164    applyShadow();
    1197 #endif
    11981165}
    11991166
Note: See TracChangeset for help on using the changeset viewer.