| 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 601 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 } | 612 } |
| 613 *reduction = SkEvalQuadAt(quad, t); | 613 *reduction = SkEvalQuadAt(quad, t); |
| 614 return kDegenerate_ReductionType; | 614 return kDegenerate_ReductionType; |
| 615 } | 615 } |
| 616 | 616 |
| 617 void SkPathStroker::conicTo(const SkPoint& pt1, const SkPoint& pt2, SkScalar wei
ght) { | 617 void SkPathStroker::conicTo(const SkPoint& pt1, const SkPoint& pt2, SkScalar wei
ght) { |
| 618 const SkConic conic(fPrevPt, pt1, pt2, weight); | 618 const SkConic conic(fPrevPt, pt1, pt2, weight); |
| 619 SkPoint reduction; | 619 SkPoint reduction; |
| 620 ReductionType reductionType = CheckConicLinear(conic, &reduction); | 620 ReductionType reductionType = CheckConicLinear(conic, &reduction); |
| 621 if (kPoint_ReductionType == reductionType) { | 621 if (kPoint_ReductionType == reductionType) { |
| 622 /* If the stroke consists of a moveTo followed by a degenerate curve, tr
eat it |
| 623 as if it were followed by a zero-length line. Lines without length |
| 624 can have square and round end caps. */ |
| 625 this->lineTo(pt2); |
| 622 return; | 626 return; |
| 623 } | 627 } |
| 624 if (kLine_ReductionType == reductionType) { | 628 if (kLine_ReductionType == reductionType) { |
| 625 this->lineTo(pt2); | 629 this->lineTo(pt2); |
| 626 return; | 630 return; |
| 627 } | 631 } |
| 628 if (kDegenerate_ReductionType == reductionType) { | 632 if (kDegenerate_ReductionType == reductionType) { |
| 629 this->lineTo(reduction); | 633 this->lineTo(reduction); |
| 630 SkStrokerPriv::JoinProc saveJoiner = fJoiner; | 634 SkStrokerPriv::JoinProc saveJoiner = fJoiner; |
| 631 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join); | 635 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 646 (void) this->conicStroke(conic, &quadPts); | 650 (void) this->conicStroke(conic, &quadPts); |
| 647 this->setConicEndNormal(conic, normalAB, unitAB, &normalBC, &unitBC); | 651 this->setConicEndNormal(conic, normalAB, unitAB, &normalBC, &unitBC); |
| 648 this->postJoinTo(pt2, normalBC, unitBC); | 652 this->postJoinTo(pt2, normalBC, unitBC); |
| 649 } | 653 } |
| 650 | 654 |
| 651 void SkPathStroker::quadTo(const SkPoint& pt1, const SkPoint& pt2) { | 655 void SkPathStroker::quadTo(const SkPoint& pt1, const SkPoint& pt2) { |
| 652 const SkPoint quad[3] = { fPrevPt, pt1, pt2 }; | 656 const SkPoint quad[3] = { fPrevPt, pt1, pt2 }; |
| 653 SkPoint reduction; | 657 SkPoint reduction; |
| 654 ReductionType reductionType = CheckQuadLinear(quad, &reduction); | 658 ReductionType reductionType = CheckQuadLinear(quad, &reduction); |
| 655 if (kPoint_ReductionType == reductionType) { | 659 if (kPoint_ReductionType == reductionType) { |
| 660 /* If the stroke consists of a moveTo followed by a degenerate curve, tr
eat it |
| 661 as if it were followed by a zero-length line. Lines without length |
| 662 can have square and round end caps. */ |
| 663 this->lineTo(pt2); |
| 656 return; | 664 return; |
| 657 } | 665 } |
| 658 if (kLine_ReductionType == reductionType) { | 666 if (kLine_ReductionType == reductionType) { |
| 659 this->lineTo(pt2); | 667 this->lineTo(pt2); |
| 660 return; | 668 return; |
| 661 } | 669 } |
| 662 if (kDegenerate_ReductionType == reductionType) { | 670 if (kDegenerate_ReductionType == reductionType) { |
| 663 this->lineTo(reduction); | 671 this->lineTo(reduction); |
| 664 SkStrokerPriv::JoinProc saveJoiner = fJoiner; | 672 SkStrokerPriv::JoinProc saveJoiner = fJoiner; |
| 665 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join); | 673 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 return true; | 1169 return true; |
| 1162 } | 1170 } |
| 1163 | 1171 |
| 1164 void SkPathStroker::cubicTo(const SkPoint& pt1, const SkPoint& pt2, | 1172 void SkPathStroker::cubicTo(const SkPoint& pt1, const SkPoint& pt2, |
| 1165 const SkPoint& pt3) { | 1173 const SkPoint& pt3) { |
| 1166 const SkPoint cubic[4] = { fPrevPt, pt1, pt2, pt3 }; | 1174 const SkPoint cubic[4] = { fPrevPt, pt1, pt2, pt3 }; |
| 1167 SkPoint reduction[3]; | 1175 SkPoint reduction[3]; |
| 1168 const SkPoint* tangentPt; | 1176 const SkPoint* tangentPt; |
| 1169 ReductionType reductionType = CheckCubicLinear(cubic, reduction, &tangentPt)
; | 1177 ReductionType reductionType = CheckCubicLinear(cubic, reduction, &tangentPt)
; |
| 1170 if (kPoint_ReductionType == reductionType) { | 1178 if (kPoint_ReductionType == reductionType) { |
| 1179 /* If the stroke consists of a moveTo followed by a degenerate curve, tr
eat it |
| 1180 as if it were followed by a zero-length line. Lines without length |
| 1181 can have square and round end caps. */ |
| 1182 this->lineTo(pt3); |
| 1171 return; | 1183 return; |
| 1172 } | 1184 } |
| 1173 if (kLine_ReductionType == reductionType) { | 1185 if (kLine_ReductionType == reductionType) { |
| 1174 this->lineTo(pt3); | 1186 this->lineTo(pt3); |
| 1175 return; | 1187 return; |
| 1176 } | 1188 } |
| 1177 if (kDegenerate_ReductionType <= reductionType && kDegenerate3_ReductionType
>= reductionType) { | 1189 if (kDegenerate_ReductionType <= reductionType && kDegenerate3_ReductionType
>= reductionType) { |
| 1178 this->lineTo(reduction[0]); | 1190 this->lineTo(reduction[0]); |
| 1179 SkStrokerPriv::JoinProc saveJoiner = fJoiner; | 1191 SkStrokerPriv::JoinProc saveJoiner = fJoiner; |
| 1180 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join); | 1192 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1469 default: | 1481 default: |
| 1470 break; | 1482 break; |
| 1471 } | 1483 } |
| 1472 | 1484 |
| 1473 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { | 1485 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { |
| 1474 r = rect; | 1486 r = rect; |
| 1475 r.inset(radius, radius); | 1487 r.inset(radius, radius); |
| 1476 dst->addRect(r, reverse_direction(dir)); | 1488 dst->addRect(r, reverse_direction(dir)); |
| 1477 } | 1489 } |
| 1478 } | 1490 } |
| OLD | NEW |