Changeset 232999 in webkit


Ignore:
Timestamp:
Jun 19, 2018 6:01:48 PM (6 years ago)
Author:
dino@apple.com
Message:

ARKit badge drop shadow updates its blur radius based on page zoom
https://bugs.webkit.org/show_bug.cgi?id=186829
<rdar://problem/40738779>

Reviewed by Tim Horton.

We need to make sure the shadow blur radius takes into account the
current zoom. Thankfully, the GraphicsContext platform code already
does this, so just use it.

  • rendering/RenderThemeIOS.mm:

(WebCore::RenderThemeIOS::paintSystemPreviewBadge):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r232997 r232999  
     12018-06-19  Dean Jackson  <dino@apple.com>
     2
     3        ARKit badge drop shadow updates its blur radius based on page zoom
     4        https://bugs.webkit.org/show_bug.cgi?id=186829
     5        <rdar://problem/40738779>
     6
     7        Reviewed by Tim Horton.
     8
     9        We need to make sure the shadow blur radius takes into account the
     10        current zoom. Thankfully, the GraphicsContext platform code already
     11        does this, so just use it.
     12
     13        * rendering/RenderThemeIOS.mm:
     14        (WebCore::RenderThemeIOS::paintSystemPreviewBadge):
     15
    1162018-06-19  Dean Jackson  <dino@apple.com>
    217
  • trunk/Source/WebCore/rendering/RenderThemeIOS.mm

    r232487 r232999  
    18571857        return;
    18581858
     1859    GraphicsContextStateSaver stateSaver(graphicsContext);
     1860
    18591861    CGContextRef ctx = graphicsContext.platformContext();
    18601862    if (!ctx)
     
    18641866
    18651867    // Draw a drop shadow around the circle.
    1866     CGFloat shadowColorComponents[4] = { 0, 0, 0, 0.1 };
    1867     RetainPtr<CGColorRef> shadowColor = adoptCF(CGColorCreate(sRGBColorSpaceRef(), shadowColorComponents));
     1868    // Use the GraphicsContext function, because it calculates the blur radius in context space,
     1869    // rather than screen space.
     1870    Color shadowColor = Color { 0.f, 0.f, 0.f, 0.1f };
     1871    graphicsContext.setShadow(FloatSize { }, 16, shadowColor);
     1872
    18681873    // The circle must have an alpha channel value of 1 for the shadow color to appear.
    18691874    CGFloat circleColorComponents[4] = { 0, 0, 0, 1 };
    18701875    RetainPtr<CGColorRef> circleColor = adoptCF(CGColorCreate(sRGBColorSpaceRef(), circleColorComponents));
    18711876    CGContextSetFillColorWithColor(ctx, circleColor.get());
    1872     CGContextSetShadowWithColor(ctx, CGSizeZero, 16, shadowColor.get());
    18731877
    18741878    // Clip out the circle to only show the shadow.
Note: See TracChangeset for help on using the changeset viewer.