Commit 31b6277f authored by calamity's avatar calamity Committed by Commit bot

Fix SkBitmapOperations::CreateDropShadow drawing too large a shadow.

This CL fixes an issue where shadows were larger than
ShadowValue::GetMargin(). This caused certain shadows to clip to the
view boundaries which looks bad.

BUG=489533

Review URL: https://codereview.chromium.org/1123393007

Cr-Commit-Position: refs/heads/master@{#330912}
parent cf788752
...@@ -743,9 +743,11 @@ SkBitmap SkBitmapOperations::CreateDropShadow( ...@@ -743,9 +743,11 @@ SkBitmap SkBitmapOperations::CreateDropShadow(
SkBitmap shadow_image = SkBitmapOperations::CreateColorMask(bitmap, SkBitmap shadow_image = SkBitmapOperations::CreateColorMask(bitmap,
shadow.color()); shadow.color());
// The blur is halved to produce a shadow that correctly fits within the
// |shadow_margin|.
SkScalar sigma = SkDoubleToScalar(shadow.blur() / 2);
skia::RefPtr<SkBlurImageFilter> filter = skia::RefPtr<SkBlurImageFilter> filter =
skia::AdoptRef(SkBlurImageFilter::Create( skia::AdoptRef(SkBlurImageFilter::Create(sigma, sigma));
SkDoubleToScalar(shadow.blur()), SkDoubleToScalar(shadow.blur())));
paint.setImageFilter(filter.get()); paint.setImageFilter(filter.get());
canvas.saveLayer(0, &paint); canvas.saveLayer(0, &paint);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment