aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPathMeasure.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2015-08-26 09:04:55 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-26 09:04:55 -0700
commit5cb00a95734143ca068960ead1ae94d0440c61da (patch)
tree7b633dd3b8acb9c454c117de09a71b8d9c1cd529 /src/core/SkPathMeasure.cpp
parenta16af21b17885c517a587482e9062efb99c19306 (diff)
zero-length cap fix
Re-land; layout tests are suppressed and gm differences are understood. A merge conflict prevented a automatic reland. If the endcap is not butt, draw the endcaps even when the line has zero length. If the dash length is zero, generate a zero length line segment. Treat a move followed by a close as a move followed by a zero-length line. TBR=reed@google.com BUG=422974 Review URL: https://codereview.chromium.org/1314213002
Diffstat (limited to 'src/core/SkPathMeasure.cpp')
-rw-r--r--src/core/SkPathMeasure.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/core/SkPathMeasure.cpp b/src/core/SkPathMeasure.cpp
index a5dd84048c..17ae95e801 100644
--- a/src/core/SkPathMeasure.cpp
+++ b/src/core/SkPathMeasure.cpp
@@ -314,7 +314,12 @@ static void seg_to(const SkPoint pts[], int segType,
SkASSERT(startT <= stopT);
if (startT == stopT) {
- return; // should we report this, to undo a moveTo?
+ /* if the dash as a zero-length on segment, add a corresponding zero-length line.
+ The stroke code will add end caps to zero length lines as appropriate */
+ SkPoint lastPt;
+ SkAssertResult(dst->getLastPt(&lastPt));
+ dst->lineTo(lastPt);
+ return;
}
SkPoint tmp0[7], tmp1[7];
@@ -568,7 +573,7 @@ bool SkPathMeasure::getSegment(SkScalar startD, SkScalar stopD, SkPath* dst,
if (stopD > length) {
stopD = length;
}
- if (startD >= stopD) {
+ if (startD > stopD) {
return false;
}