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

Side by Side Diff: ui/gfx/paint_vector_icon.cc

Issue 2002293002: Use vector icon for Ash shelf launcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add arc support, include .icon files Created 4 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
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 #include "ui/gfx/paint_vector_icon.h" 5 #include "ui/gfx/paint_vector_icon.h"
6 6
7 #include <map> 7 #include <map>
8 #include <tuple> 8 #include <tuple>
9 9
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 19 matching lines...) Expand all
30 if (source == #command) \ 30 if (source == #command) \
31 return command; 31 return command;
32 32
33 RETURN_IF_IS(NEW_PATH); 33 RETURN_IF_IS(NEW_PATH);
34 RETURN_IF_IS(PATH_COLOR_ARGB); 34 RETURN_IF_IS(PATH_COLOR_ARGB);
35 RETURN_IF_IS(PATH_MODE_CLEAR); 35 RETURN_IF_IS(PATH_MODE_CLEAR);
36 RETURN_IF_IS(STROKE); 36 RETURN_IF_IS(STROKE);
37 RETURN_IF_IS(CAP_SQUARE); 37 RETURN_IF_IS(CAP_SQUARE);
38 RETURN_IF_IS(MOVE_TO); 38 RETURN_IF_IS(MOVE_TO);
39 RETURN_IF_IS(R_MOVE_TO); 39 RETURN_IF_IS(R_MOVE_TO);
40 RETURN_IF_IS(ARC_TO);
41 RETURN_IF_IS(R_ARC_TO);
40 RETURN_IF_IS(LINE_TO); 42 RETURN_IF_IS(LINE_TO);
41 RETURN_IF_IS(R_LINE_TO); 43 RETURN_IF_IS(R_LINE_TO);
42 RETURN_IF_IS(H_LINE_TO); 44 RETURN_IF_IS(H_LINE_TO);
43 RETURN_IF_IS(R_H_LINE_TO); 45 RETURN_IF_IS(R_H_LINE_TO);
44 RETURN_IF_IS(V_LINE_TO); 46 RETURN_IF_IS(V_LINE_TO);
45 RETURN_IF_IS(R_V_LINE_TO); 47 RETURN_IF_IS(R_V_LINE_TO);
46 RETURN_IF_IS(CUBIC_TO); 48 RETURN_IF_IS(CUBIC_TO);
47 RETURN_IF_IS(R_CUBIC_TO); 49 RETURN_IF_IS(R_CUBIC_TO);
48 RETURN_IF_IS(CIRCLE); 50 RETURN_IF_IS(CIRCLE);
49 RETURN_IF_IS(ROUND_RECT); 51 RETURN_IF_IS(ROUND_RECT);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 break; 140 break;
139 } 141 }
140 142
141 case R_MOVE_TO: { 143 case R_MOVE_TO: {
142 SkScalar x = path_elements[++i].arg; 144 SkScalar x = path_elements[++i].arg;
143 SkScalar y = path_elements[++i].arg; 145 SkScalar y = path_elements[++i].arg;
144 path.rMoveTo(x, y); 146 path.rMoveTo(x, y);
145 break; 147 break;
146 } 148 }
147 149
150 case ARC_TO: {
151 SkScalar rx = path_elements[++i].arg;
152 SkScalar ry = path_elements[++i].arg;
153 SkScalar angle = path_elements[++i].arg;
154 SkScalar large_arc_flag = path_elements[++i].arg;
155 SkScalar arc_sweep_flag = path_elements[++i].arg;
156 SkScalar x = path_elements[++i].arg;
157 SkScalar y = path_elements[++i].arg;
158 path.arcTo(
159 rx, ry, angle,
160 large_arc_flag ? SkPath::kLarge_ArcSize : SkPath::kSmall_ArcSize,
161 arc_sweep_flag ? SkPath::kCW_Direction : SkPath::kCCW_Direction,
162 x, y);
163 break;
164 }
165
166 case R_ARC_TO: {
167 SkScalar rx = path_elements[++i].arg;
168 SkScalar ry = path_elements[++i].arg;
169 SkScalar angle = path_elements[++i].arg;
170 SkScalar large_arc_flag = path_elements[++i].arg;
171 SkScalar arc_sweep_flag = path_elements[++i].arg;
172 SkScalar x = path_elements[++i].arg;
173 SkScalar y = path_elements[++i].arg;
174 path.rArcTo(
175 rx, ry, angle,
176 large_arc_flag ? SkPath::kLarge_ArcSize : SkPath::kSmall_ArcSize,
177 arc_sweep_flag ? SkPath::kCW_Direction : SkPath::kCCW_Direction,
178 x, y);
179 break;
180 }
181
148 case LINE_TO: { 182 case LINE_TO: {
149 SkScalar x = path_elements[++i].arg; 183 SkScalar x = path_elements[++i].arg;
150 SkScalar y = path_elements[++i].arg; 184 SkScalar y = path_elements[++i].arg;
151 path.lineTo(x, y); 185 path.lineTo(x, y);
152 break; 186 break;
153 } 187 }
154 188
155 case R_LINE_TO: { 189 case R_LINE_TO: {
156 SkScalar x = path_elements[++i].arg; 190 SkScalar x = path_elements[++i].arg;
157 SkScalar y = path_elements[++i].arg; 191 SkScalar y = path_elements[++i].arg;
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 454
421 ImageSkia CreateVectorIconFromSource(const std::string& source, 455 ImageSkia CreateVectorIconFromSource(const std::string& source,
422 size_t dip_size, 456 size_t dip_size,
423 SkColor color) { 457 SkColor color) {
424 return ImageSkia( 458 return ImageSkia(
425 new VectorIconSource(source, dip_size, color), 459 new VectorIconSource(source, dip_size, color),
426 gfx::Size(static_cast<int>(dip_size), static_cast<int>(dip_size))); 460 gfx::Size(static_cast<int>(dip_size), static_cast<int>(dip_size)));
427 } 461 }
428 462
429 } // namespace gfx 463 } // namespace gfx
OLDNEW
« ash/shelf/app_list_button.cc ('K') | « ui/gfx/BUILD.gn ('k') | ui/gfx/vector_icon_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698