OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This file provides defines needed by PaintVectorIcon and is implemented | 5 // This file provides defines needed by PaintVectorIcon and is implemented |
6 // by the generated file vector_icons.cc. | 6 // by the generated file vector_icons.cc. |
7 | 7 |
8 #ifndef UI_GFX_VECTOR_ICON_TYPES_H_ | 8 #ifndef UI_GFX_VECTOR_ICON_TYPES_H_ |
9 #define UI_GFX_VECTOR_ICON_TYPES_H_ | 9 #define UI_GFX_VECTOR_ICON_TYPES_H_ |
10 | 10 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
57 DISABLE_AA, | 57 DISABLE_AA, |
58 // Flips the x-axis in RTL locales. Default is false, this command sets it to | 58 // Flips the x-axis in RTL locales. Default is false, this command sets it to |
59 // true. | 59 // true. |
60 FLIPS_IN_RTL, | 60 FLIPS_IN_RTL, |
61 // Marks the end of the list of commands. | 61 // Marks the end of the list of commands. |
62 END | 62 END |
63 }; | 63 }; |
64 | 64 |
65 // A POD that describes either a path command or an argument for it. | 65 // A POD that describes either a path command or an argument for it. |
66 struct PathElement { | 66 struct PathElement { |
67 PathElement(CommandType value) : type(value) {} | 67 constexpr PathElement(CommandType value) : type(value) {} |
Evan Stade
2017/01/10 17:30:26
I believe your tree is slightly out of date :)
brucedawson
2017/01/10 18:31:54
What bizarre timing that I made this change the sa
| |
68 PathElement(SkScalar value) : arg(value) {} | 68 constexpr PathElement(SkScalar value) : arg(value) {} |
69 | 69 |
70 union { | 70 union { |
71 CommandType type; | 71 CommandType type; |
72 SkScalar arg; | 72 SkScalar arg; |
73 }; | 73 }; |
74 }; | 74 }; |
75 | 75 |
76 struct VectorIcon { | 76 struct VectorIcon { |
77 VectorIcon() : path_(nullptr), path_1x_(nullptr) {} | 77 VectorIcon() : path_(nullptr), path_1x_(nullptr) {} |
78 VectorIcon(gfx::PathElement* path, gfx::PathElement* path_1x) | 78 VectorIcon(gfx::PathElement* path, gfx::PathElement* path_1x) |
79 : path_(path), path_1x_(path_1x) {} | 79 : path_(path), path_1x_(path_1x) {} |
80 | 80 |
81 bool is_empty() const { return !path_; } | 81 bool is_empty() const { return !path_; } |
82 | 82 |
83 gfx::PathElement* path_; | 83 gfx::PathElement* path_; |
84 gfx::PathElement* path_1x_; | 84 gfx::PathElement* path_1x_; |
85 }; | 85 }; |
86 | 86 |
87 // Returns an array of path commands and arguments, terminated by END. | 87 // Returns an array of path commands and arguments, terminated by END. |
88 const PathElement* GetPathForVectorIcon(VectorIconId id); | 88 const PathElement* GetPathForVectorIcon(VectorIconId id); |
89 // As above, but returns an icon specifically adjusted for 1x scale factors. | 89 // As above, but returns an icon specifically adjusted for 1x scale factors. |
90 // This draws from icon files that end with .1x.icon. If no such file exists, | 90 // This draws from icon files that end with .1x.icon. If no such file exists, |
91 // it will fall back to GetPathForVectorIcon. | 91 // it will fall back to GetPathForVectorIcon. |
92 const PathElement* GetPathForVectorIconAt1xScale(VectorIconId id); | 92 const PathElement* GetPathForVectorIconAt1xScale(VectorIconId id); |
93 | 93 |
94 } // namespace gfx | 94 } // namespace gfx |
95 | 95 |
96 #endif // UI_GFX_VECTOR_ICON_TYPES_H_ | 96 #endif // UI_GFX_VECTOR_ICON_TYPES_H_ |
OLD | NEW |