OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 The Android Open Source Project |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkStrokerPriv.h" | 8 #include "SkStrokerPriv.h" |
9 #include "SkGeometry.h" | 9 #include "SkGeometry.h" |
10 #include "SkPathPriv.h" | 10 #include "SkPathPriv.h" |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 case SkPath::kConic_Verb: | 390 case SkPath::kConic_Verb: |
391 if (pts[0] == pts[1] && pts[0] == pts[2]) { | 391 if (pts[0] == pts[1] && pts[0] == pts[2]) { |
392 continue; | 392 continue; |
393 } | 393 } |
394 return true; | 394 return true; |
395 case SkPath::kCubic_Verb: | 395 case SkPath::kCubic_Verb: |
396 if (pts[0] == pts[1] && pts[0] == pts[2] && pts[0] == pts[3]) { | 396 if (pts[0] == pts[1] && pts[0] == pts[2] && pts[0] == pts[3]) { |
397 continue; | 397 continue; |
398 } | 398 } |
399 return true; | 399 return true; |
400 case SkPath::kClose_Verb: | 400 case SkPath::kClose_Verb: |
401 case SkPath::kDone_Verb: | 401 case SkPath::kDone_Verb: |
402 return false; | 402 return false; |
403 } | 403 } |
404 } | 404 } |
405 return false; | 405 return false; |
406 } | 406 } |
407 | 407 |
408 void SkPathStroker::lineTo(const SkPoint& currPt, const SkPath::Iter* iter) { | 408 void SkPathStroker::lineTo(const SkPoint& currPt, const SkPath::Iter* iter) { |
409 bool teenyLine = fPrevPt.equalsWithinTolerance(currPt, SK_ScalarNearlyZero *
fInvResScale); | 409 bool teenyLine = fPrevPt.equalsWithinTolerance(currPt, SK_ScalarNearlyZero *
fInvResScale); |
410 if (SkStrokerPriv::CapFactory(SkPaint::kButt_Cap) == fCapper && teenyLine) { | 410 if (SkStrokerPriv::CapFactory(SkPaint::kButt_Cap) == fCapper && teenyLine) { |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 } | 620 } |
621 #if 0 // once findMaxCurvature is implemented, this will be a better solution | 621 #if 0 // once findMaxCurvature is implemented, this will be a better solution |
622 SkScalar t; | 622 SkScalar t; |
623 if (!conic.findMaxCurvature(&t) || 0 == t) { | 623 if (!conic.findMaxCurvature(&t) || 0 == t) { |
624 return kLine_ReductionType; | 624 return kLine_ReductionType; |
625 } | 625 } |
626 #else // but for now, use extrema instead | 626 #else // but for now, use extrema instead |
627 SkScalar xT = 0, yT = 0; | 627 SkScalar xT = 0, yT = 0; |
628 (void) conic.findXExtrema(&xT); | 628 (void) conic.findXExtrema(&xT); |
629 (void) conic.findYExtrema(&yT); | 629 (void) conic.findYExtrema(&yT); |
630 SkScalar t = SkTMax(xT, yT); | 630 SkScalar t = SkTMax(xT, yT); |
631 if (0 == t) { | 631 if (0 == t) { |
632 return kLine_ReductionType; | 632 return kLine_ReductionType; |
633 } | 633 } |
634 #endif | 634 #endif |
635 conic.evalAt(t, reduction, nullptr); | 635 conic.evalAt(t, reduction, nullptr); |
636 return kDegenerate_ReductionType; | 636 return kDegenerate_ReductionType; |
637 } | 637 } |
638 | 638 |
639 SkPathStroker::ReductionType SkPathStroker::CheckQuadLinear(const SkPoint quad[3
], | 639 SkPathStroker::ReductionType SkPathStroker::CheckQuadLinear(const SkPoint quad[3
], |
640 SkPoint* reduction) { | 640 SkPoint* reduction) { |
(...skipping 890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 default: | 1531 default: |
1532 break; | 1532 break; |
1533 } | 1533 } |
1534 | 1534 |
1535 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { | 1535 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { |
1536 r = rect; | 1536 r = rect; |
1537 r.inset(radius, radius); | 1537 r.inset(radius, radius); |
1538 dst->addRect(r, reverse_direction(dir)); | 1538 dst->addRect(r, reverse_direction(dir)); |
1539 } | 1539 } |
1540 } | 1540 } |
OLD | NEW |