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

Unified Diff: ui/gfx/paint_vector_icon.cc

Issue 2068893003: Share more code in ARC_TO/R_ARC_TO (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: inline 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/paint_vector_icon.cc
diff --git a/ui/gfx/paint_vector_icon.cc b/ui/gfx/paint_vector_icon.cc
index 182f42e605503fc450f4dda3e3fda8bc08252b06..52c1e9a9f50936ef6a500080a97b6d70a4138df2 100644
--- a/ui/gfx/paint_vector_icon.cc
+++ b/ui/gfx/paint_vector_icon.cc
@@ -147,22 +147,7 @@ void PaintPath(Canvas* canvas,
break;
}
- case ARC_TO: {
- SkScalar rx = path_elements[++i].arg;
- SkScalar ry = path_elements[++i].arg;
- SkScalar angle = path_elements[++i].arg;
- SkScalar large_arc_flag = path_elements[++i].arg;
- SkScalar arc_sweep_flag = path_elements[++i].arg;
- SkScalar x = path_elements[++i].arg;
- SkScalar y = path_elements[++i].arg;
- path.arcTo(
- rx, ry, angle,
- large_arc_flag ? SkPath::kLarge_ArcSize : SkPath::kSmall_ArcSize,
- arc_sweep_flag ? SkPath::kCW_Direction : SkPath::kCCW_Direction,
- x, y);
- break;
- }
-
+ case ARC_TO:
case R_ARC_TO: {
SkScalar rx = path_elements[++i].arg;
SkScalar ry = path_elements[++i].arg;
@@ -171,7 +156,14 @@ void PaintPath(Canvas* canvas,
SkScalar arc_sweep_flag = path_elements[++i].arg;
SkScalar x = path_elements[++i].arg;
SkScalar y = path_elements[++i].arg;
- path.rArcTo(
+
+ auto path_fn =
+ path_elements[i].type == ARC_TO
+ ? 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.
+ SkScalar, SkScalar, SkScalar, SkPath::ArcSize,
+ SkPath::Direction, SkScalar, SkScalar)>(&SkPath::arcTo)
+ : &SkPath::rArcTo;
+ (path.*path_fn)(
rx, ry, angle,
large_arc_flag ? SkPath::kLarge_ArcSize : SkPath::kSmall_ArcSize,
arc_sweep_flag ? SkPath::kCW_Direction : SkPath::kCCW_Direction,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698