Chromium Code Reviews| 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 #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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 break; | 140 break; |
| 141 } | 141 } |
| 142 | 142 |
| 143 case R_MOVE_TO: { | 143 case R_MOVE_TO: { |
| 144 SkScalar x = path_elements[++i].arg; | 144 SkScalar x = path_elements[++i].arg; |
| 145 SkScalar y = path_elements[++i].arg; | 145 SkScalar y = path_elements[++i].arg; |
| 146 path.rMoveTo(x, y); | 146 path.rMoveTo(x, y); |
| 147 break; | 147 break; |
| 148 } | 148 } |
| 149 | 149 |
| 150 case ARC_TO: { | 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: { | 151 case R_ARC_TO: { |
| 167 SkScalar rx = path_elements[++i].arg; | 152 SkScalar rx = path_elements[++i].arg; |
| 168 SkScalar ry = path_elements[++i].arg; | 153 SkScalar ry = path_elements[++i].arg; |
| 169 SkScalar angle = path_elements[++i].arg; | 154 SkScalar angle = path_elements[++i].arg; |
| 170 SkScalar large_arc_flag = path_elements[++i].arg; | 155 SkScalar large_arc_flag = path_elements[++i].arg; |
| 171 SkScalar arc_sweep_flag = path_elements[++i].arg; | 156 SkScalar arc_sweep_flag = path_elements[++i].arg; |
| 172 SkScalar x = path_elements[++i].arg; | 157 SkScalar x = path_elements[++i].arg; |
| 173 SkScalar y = path_elements[++i].arg; | 158 SkScalar y = path_elements[++i].arg; |
| 174 path.rArcTo( | 159 |
| 160 auto path_fn = | |
| 161 path_elements[i].type == ARC_TO | |
| 162 ? static_cast<void (SkPath::*)( | |
|
Evan Stade
2016/06/15 18:51:36
this came out a bit longer than expected because o
tdanderson
2016/06/15 19:23:29
That's sort of a shame.
| |
| 163 SkScalar, SkScalar, SkScalar, SkPath::ArcSize, | |
| 164 SkPath::Direction, SkScalar, SkScalar)>(&SkPath::arcTo) | |
| 165 : &SkPath::rArcTo; | |
| 166 (path.*path_fn)( | |
| 175 rx, ry, angle, | 167 rx, ry, angle, |
| 176 large_arc_flag ? SkPath::kLarge_ArcSize : SkPath::kSmall_ArcSize, | 168 large_arc_flag ? SkPath::kLarge_ArcSize : SkPath::kSmall_ArcSize, |
| 177 arc_sweep_flag ? SkPath::kCW_Direction : SkPath::kCCW_Direction, | 169 arc_sweep_flag ? SkPath::kCW_Direction : SkPath::kCCW_Direction, |
| 178 x, y); | 170 x, y); |
| 179 break; | 171 break; |
| 180 } | 172 } |
| 181 | 173 |
| 182 case LINE_TO: { | 174 case LINE_TO: { |
| 183 SkScalar x = path_elements[++i].arg; | 175 SkScalar x = path_elements[++i].arg; |
| 184 SkScalar y = path_elements[++i].arg; | 176 SkScalar y = path_elements[++i].arg; |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 454 | 446 |
| 455 ImageSkia CreateVectorIconFromSource(const std::string& source, | 447 ImageSkia CreateVectorIconFromSource(const std::string& source, |
| 456 size_t dip_size, | 448 size_t dip_size, |
| 457 SkColor color) { | 449 SkColor color) { |
| 458 return ImageSkia( | 450 return ImageSkia( |
| 459 new VectorIconSource(source, dip_size, color), | 451 new VectorIconSource(source, dip_size, color), |
| 460 gfx::Size(static_cast<int>(dip_size), static_cast<int>(dip_size))); | 452 gfx::Size(static_cast<int>(dip_size), static_cast<int>(dip_size))); |
| 461 } | 453 } |
| 462 | 454 |
| 463 } // namespace gfx | 455 } // namespace gfx |
| OLD | NEW |