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

Side by Side Diff: ui/gfx/vector_icon_types.h

Issue 2618403002: Reland crrev.com/8283cad74e0cad4840d1f with fix for static initializers. (Closed)
Patch Set: re-up Created 3 years, 11 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
OLDNEW
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
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) {}
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) {}
78 VectorIcon(gfx::PathElement* path, gfx::PathElement* path_1x)
79 : path_(path), path_1x_(path_1x) {}
80
81 bool is_empty() const { return !path_; } 77 bool is_empty() const { return !path_; }
82 78
83 gfx::PathElement* path_; 79 const gfx::PathElement* path_;
84 gfx::PathElement* path_1x_; 80 const gfx::PathElement* path_1x_;
85 }; 81 };
86 82
87 // Returns an array of path commands and arguments, terminated by END. 83 // Returns an array of path commands and arguments, terminated by END.
88 const PathElement* GetPathForVectorIcon(VectorIconId id); 84 const PathElement* GetPathForVectorIcon(VectorIconId id);
89 // As above, but returns an icon specifically adjusted for 1x scale factors. 85 // 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, 86 // This draws from icon files that end with .1x.icon. If no such file exists,
91 // it will fall back to GetPathForVectorIcon. 87 // it will fall back to GetPathForVectorIcon.
92 const PathElement* GetPathForVectorIconAt1xScale(VectorIconId id); 88 const PathElement* GetPathForVectorIconAt1xScale(VectorIconId id);
93 89
94 } // namespace gfx 90 } // namespace gfx
95 91
96 #endif // UI_GFX_VECTOR_ICON_TYPES_H_ 92 #endif // UI_GFX_VECTOR_ICON_TYPES_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698