Skip to content
Permalink
Browse files
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):

Canonical link: https://commits.webkit.org/202099@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@232999 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
grorg committed Jun 20, 2018
1 parent e1d27d2 commit c919a8c71e60f55587c306c28079c76ebe11f2b6
Showing 2 changed files with 22 additions and 3 deletions.
@@ -1,3 +1,18 @@
2018-06-19 Dean Jackson <dino@apple.com>

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

2018-06-19 Dean Jackson <dino@apple.com>

Blank viewer comes up and then auto-dismisses when device is not connected to Internet
@@ -1856,20 +1856,24 @@ static void paintAttachmentBorder(GraphicsContext& context, Path& borderPath)
if (graphicsContext.paintingDisabled())
return;

GraphicsContextStateSaver stateSaver(graphicsContext);

CGContextRef ctx = graphicsContext.platformContext();
if (!ctx)
return;

CGContextSaveGState(ctx);

// Draw a drop shadow around the circle.
CGFloat shadowColorComponents[4] = { 0, 0, 0, 0.1 };
RetainPtr<CGColorRef> shadowColor = adoptCF(CGColorCreate(sRGBColorSpaceRef(), shadowColorComponents));
// Use the GraphicsContext function, because it calculates the blur radius in context space,
// rather than screen space.
Color shadowColor = Color { 0.f, 0.f, 0.f, 0.1f };
graphicsContext.setShadow(FloatSize { }, 16, shadowColor);

// The circle must have an alpha channel value of 1 for the shadow color to appear.
CGFloat circleColorComponents[4] = { 0, 0, 0, 1 };
RetainPtr<CGColorRef> circleColor = adoptCF(CGColorCreate(sRGBColorSpaceRef(), circleColorComponents));
CGContextSetFillColorWithColor(ctx, circleColor.get());
CGContextSetShadowWithColor(ctx, CGSizeZero, 16, shadowColor.get());

// Clip out the circle to only show the shadow.
CGContextBeginPath(ctx);

0 comments on commit c919a8c

Please sign in to comment.