OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_util.h" | 5 #include "ui/gfx/shadow_util.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // "Key shadow": y offset is elevation and blur is twice the elevation. | 99 // "Key shadow": y offset is elevation and blur is twice the elevation. |
100 shadow->values.emplace_back(gfx::Vector2d(0, elevation), | 100 shadow->values.emplace_back(gfx::Vector2d(0, elevation), |
101 kBlurCorrection * elevation * 2, | 101 kBlurCorrection * elevation * 2, |
102 SkColorSetA(SK_ColorBLACK, 0x3d)); | 102 SkColorSetA(SK_ColorBLACK, 0x3d)); |
103 // "Ambient shadow": no offset and blur matches the elevation. | 103 // "Ambient shadow": no offset and blur matches the elevation. |
104 shadow->values.emplace_back(gfx::Vector2d(), kBlurCorrection * elevation, | 104 shadow->values.emplace_back(gfx::Vector2d(), kBlurCorrection * elevation, |
105 SkColorSetA(SK_ColorBLACK, 0x1f)); | 105 SkColorSetA(SK_ColorBLACK, 0x1f)); |
106 // To see what this looks like for elevation 24, try this CSS: | 106 // To see what this looks like for elevation 24, try this CSS: |
107 // box-shadow: 0 24px 48px rgba(0, 0, 0, .24), | 107 // box-shadow: 0 24px 48px rgba(0, 0, 0, .24), |
108 // 0 0 24px rgba(0, 0, 0, .12); | 108 // 0 0 24px rgba(0, 0, 0, .12); |
109 auto source = new ShadowNineboxSource(shadow->values, corner_radius); | 109 auto* source = new ShadowNineboxSource(shadow->values, corner_radius); |
110 shadow->ninebox_image = ImageSkia(source, source->size()); | 110 shadow->ninebox_image = ImageSkia(source, source->size()); |
111 return *shadow; | 111 return *shadow; |
112 } | 112 } |
113 | 113 |
114 } // namespace gfx | 114 } // namespace gfx |
OLD | NEW |