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

Unified Diff: ui/gfx/shadow_value.cc

Issue 2951583002: Update voice interaction icon shadow (Closed)
Patch Set: fix const Created 3 years, 6 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 | « ui/gfx/shadow_value.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/shadow_value.cc
diff --git a/ui/gfx/shadow_value.cc b/ui/gfx/shadow_value.cc
index a8ab3f894366b49aab025aa317397c28a2aa2736..9f1779748018b566c64b48ef83aef82e0b70cfce 100644
--- a/ui/gfx/shadow_value.cc
+++ b/ui/gfx/shadow_value.cc
@@ -80,4 +80,24 @@ Insets ShadowValue::GetBlurRegion(const ShadowValues& shadows) {
return GetInsets(shadows, true);
}
+// static
+ShadowValues ShadowValue::MakeMdShadowValues(int elevation) {
+ ShadowValues shadow_values;
+ // To match the CSS notion of blur (spread outside the bounding box) to the
+ // Skia notion of blur (spread outside and inside the bounding box), we have
+ // to double the designer-provided blur values.
+ const int kBlurCorrection = 2;
+ // "Key shadow": y offset is elevation and blur is twice the elevation.
+ shadow_values.emplace_back(gfx::Vector2d(0, elevation),
+ kBlurCorrection * elevation * 2,
+ SkColorSetA(SK_ColorBLACK, 0x3d));
+ // "Ambient shadow": no offset and blur matches the elevation.
+ shadow_values.emplace_back(gfx::Vector2d(), kBlurCorrection * elevation,
+ SkColorSetA(SK_ColorBLACK, 0x1f));
+ // To see what this looks like for elevation 24, try this CSS:
+ // box-shadow: 0 24px 48px rgba(0, 0, 0, .24),
+ // 0 0 24px rgba(0, 0, 0, .12);
+ return shadow_values;
+}
+
} // namespace gfx
« no previous file with comments | « ui/gfx/shadow_value.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698