Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit 0ebe2b5

Browse files
committed
[[ Bug 15035 ]] Fix wrong points given by MCGPathIterate
1 parent 2d289fc commit 0ebe2b5

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

docs/notes/bugfix-15035.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# LCB-Canvas: Svg path loses data in roundtrip

libgraphics/src/path.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,8 @@ bool MCGPathIterate(MCGPathRef self, MCGPathIterateCallback p_callback, void *p_
953953
SkPath::Verb t_verb;
954954
SkPoint t_sk_points[4];
955955

956+
// IM-2015-03-20: [[ Bug 15035 ]] The first point returned by SkPath::Iter::next() is
957+
// always the last moveTo point; the points for the current verb start at index 1.
956958
while (t_success && (t_verb = t_iter.next(t_sk_points)) != SkPath::kDone_Verb)
957959
{
958960
switch(t_verb)
@@ -969,22 +971,22 @@ bool MCGPathIterate(MCGPathRef self, MCGPathIterateCallback p_callback, void *p_
969971
continue;
970972

971973
t_command = kMCGPathCommandLineTo;
972-
t_points[0] = MCGPointFromSkPoint(t_sk_points[0]);
974+
t_points[0] = MCGPointFromSkPoint(t_sk_points[1]);
973975
t_point_count = 1;
974976
break;
975977

976978
case SkPath::kQuad_Verb:
977979
t_command = kMCGPathCommandQuadCurveTo;
978-
t_points[0] = MCGPointFromSkPoint(t_sk_points[0]);
979-
t_points[1] = MCGPointFromSkPoint(t_sk_points[1]);
980+
t_points[0] = MCGPointFromSkPoint(t_sk_points[1]);
981+
t_points[1] = MCGPointFromSkPoint(t_sk_points[2]);
980982
t_point_count = 2;
981983
break;
982984

983985
case SkPath::kCubic_Verb:
984986
t_command = kMCGPathCommandCubicCurveTo;
985-
t_points[0] = MCGPointFromSkPoint(t_sk_points[0]);
986-
t_points[1] = MCGPointFromSkPoint(t_sk_points[1]);
987-
t_points[2] = MCGPointFromSkPoint(t_sk_points[2]);
987+
t_points[0] = MCGPointFromSkPoint(t_sk_points[1]);
988+
t_points[1] = MCGPointFromSkPoint(t_sk_points[2]);
989+
t_points[2] = MCGPointFromSkPoint(t_sk_points[3]);
988990
t_point_count = 3;
989991
break;
990992

0 commit comments

Comments
 (0)