Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1303)

Unified Diff: ui/gfx/skbitmap_operations.cc

Issue 1123393007: Fix SkBitmapOperations::CreateDropShadow drawing too large a shadow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/skbitmap_operations.cc
diff --git a/ui/gfx/skbitmap_operations.cc b/ui/gfx/skbitmap_operations.cc
index 76aa763fa43905a6a20a1ecfe74276f4349ed929..55328ff1e01aa5a5afbe8aae300113948a3782f3 100644
--- a/ui/gfx/skbitmap_operations.cc
+++ b/ui/gfx/skbitmap_operations.cc
@@ -741,9 +741,11 @@ SkBitmap SkBitmapOperations::CreateDropShadow(
SkBitmap shadow_image = SkBitmapOperations::CreateColorMask(bitmap,
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::AdoptRef(SkBlurImageFilter::Create(
- SkDoubleToScalar(shadow.blur()), SkDoubleToScalar(shadow.blur())));
+ skia::AdoptRef(SkBlurImageFilter::Create(sigma, sigma));
paint.setImageFilter(filter.get());
canvas.saveLayer(0, &paint);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698