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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « ui/gfx/shadow_value.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gfx/shadow_value.h" 5 #include "ui/gfx/shadow_value.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 Insets ShadowValue::GetMargin(const ShadowValues& shadows) { 73 Insets ShadowValue::GetMargin(const ShadowValues& shadows) {
74 gfx::Insets margins = GetInsets(shadows, false); 74 gfx::Insets margins = GetInsets(shadows, false);
75 return -margins; 75 return -margins;
76 } 76 }
77 77
78 // static 78 // static
79 Insets ShadowValue::GetBlurRegion(const ShadowValues& shadows) { 79 Insets ShadowValue::GetBlurRegion(const ShadowValues& shadows) {
80 return GetInsets(shadows, true); 80 return GetInsets(shadows, true);
81 } 81 }
82 82
83 // static
84 ShadowValues ShadowValue::MakeMdShadowValues(int elevation) {
85 ShadowValues shadow_values;
86 // To match the CSS notion of blur (spread outside the bounding box) to the
87 // Skia notion of blur (spread outside and inside the bounding box), we have
88 // to double the designer-provided blur values.
89 const int kBlurCorrection = 2;
90 // "Key shadow": y offset is elevation and blur is twice the elevation.
91 shadow_values.emplace_back(gfx::Vector2d(0, elevation),
92 kBlurCorrection * elevation * 2,
93 SkColorSetA(SK_ColorBLACK, 0x3d));
94 // "Ambient shadow": no offset and blur matches the elevation.
95 shadow_values.emplace_back(gfx::Vector2d(), kBlurCorrection * elevation,
96 SkColorSetA(SK_ColorBLACK, 0x1f));
97 // To see what this looks like for elevation 24, try this CSS:
98 // box-shadow: 0 24px 48px rgba(0, 0, 0, .24),
99 // 0 0 24px rgba(0, 0, 0, .12);
100 return shadow_values;
101 }
102
83 } // namespace gfx 103 } // namespace gfx
OLDNEW
« 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