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

Side by Side Diff: src/core/SkPathMeasure.cpp

Issue 1304163008: Revert of experiment with zero-length round capped line segments (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « include/core/SkPaint.h ('k') | src/core/SkStroke.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkPathMeasure.h" 10 #include "SkPathMeasure.h"
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 307 }
308 } 308 }
309 309
310 static void seg_to(const SkPoint pts[], int segType, 310 static void seg_to(const SkPoint pts[], int segType,
311 SkScalar startT, SkScalar stopT, SkPath* dst) { 311 SkScalar startT, SkScalar stopT, SkPath* dst) {
312 SkASSERT(startT >= 0 && startT <= SK_Scalar1); 312 SkASSERT(startT >= 0 && startT <= SK_Scalar1);
313 SkASSERT(stopT >= 0 && stopT <= SK_Scalar1); 313 SkASSERT(stopT >= 0 && stopT <= SK_Scalar1);
314 SkASSERT(startT <= stopT); 314 SkASSERT(startT <= stopT);
315 315
316 if (startT == stopT) { 316 if (startT == stopT) {
317 /* if the dash as a zero-length on segment, add a corresponding zero-len gth line. 317 return; // should we report this, to undo a moveTo?
318 The stroke code will add end caps to zero length lines as appropriate */
319 SkPoint lastPt;
320 SkAssertResult(dst->getLastPt(&lastPt));
321 dst->lineTo(lastPt);
322 return;
323 } 318 }
324 319
325 SkPoint tmp0[7], tmp1[7]; 320 SkPoint tmp0[7], tmp1[7];
326 321
327 switch (segType) { 322 switch (segType) {
328 case kLine_SegType: 323 case kLine_SegType:
329 if (SK_Scalar1 == stopT) { 324 if (SK_Scalar1 == stopT) {
330 dst->lineTo(pts[1]); 325 dst->lineTo(pts[1]);
331 } else { 326 } else {
332 dst->lineTo(SkScalarInterp(pts[0].fX, pts[1].fX, stopT), 327 dst->lineTo(SkScalarInterp(pts[0].fX, pts[1].fX, stopT),
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 SkASSERT(dst); 561 SkASSERT(dst);
567 562
568 SkScalar length = this->getLength(); // ensure we have built our segments 563 SkScalar length = this->getLength(); // ensure we have built our segments
569 564
570 if (startD < 0) { 565 if (startD < 0) {
571 startD = 0; 566 startD = 0;
572 } 567 }
573 if (stopD > length) { 568 if (stopD > length) {
574 stopD = length; 569 stopD = length;
575 } 570 }
576 if (startD > stopD) { 571 if (startD >= stopD) {
577 return false; 572 return false;
578 } 573 }
579 574
580 SkPoint p; 575 SkPoint p;
581 SkScalar startT, stopT; 576 SkScalar startT, stopT;
582 const Segment* seg = this->distanceToSegment(startD, &startT); 577 const Segment* seg = this->distanceToSegment(startD, &startT);
583 const Segment* stopSeg = this->distanceToSegment(stopD, &stopT); 578 const Segment* stopSeg = this->distanceToSegment(stopD, &stopT);
584 SkASSERT(seg <= stopSeg); 579 SkASSERT(seg <= stopSeg);
585 580
586 if (startWithMoveTo) { 581 if (startWithMoveTo) {
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
624 619
625 for (int i = 0; i < fSegments.count(); i++) { 620 for (int i = 0; i < fSegments.count(); i++) {
626 const Segment* seg = &fSegments[i]; 621 const Segment* seg = &fSegments[i];
627 SkDebugf("pathmeas: seg[%d] distance=%g, point=%d, t=%g, type=%d\n", 622 SkDebugf("pathmeas: seg[%d] distance=%g, point=%d, t=%g, type=%d\n",
628 i, seg->fDistance, seg->fPtIndex, seg->getScalarT(), 623 i, seg->fDistance, seg->fPtIndex, seg->getScalarT(),
629 seg->fType); 624 seg->fType);
630 } 625 }
631 } 626 }
632 627
633 #endif 628 #endif
OLDNEW
« no previous file with comments | « include/core/SkPaint.h ('k') | src/core/SkStroke.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698