Chromium Code Reviews| 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 this->lineTo(pt2); | |
|
reed1
2015/09/03 19:07:27
Do we add a lineTo to trigger some follow-on heuri
caryclark
2015/09/03 19:37:57
Added comment (done)
| |
| 622 return; | 623 return; |
| 623 } | 624 } |
| 624 if (kLine_ReductionType == reductionType) { | 625 if (kLine_ReductionType == reductionType) { |
| 625 this->lineTo(pt2); | 626 this->lineTo(pt2); |
| 626 return; | 627 return; |
| 627 } | 628 } |
| 628 if (kDegenerate_ReductionType == reductionType) { | 629 if (kDegenerate_ReductionType == reductionType) { |
| 629 this->lineTo(reduction); | 630 this->lineTo(reduction); |
| 630 SkStrokerPriv::JoinProc saveJoiner = fJoiner; | 631 SkStrokerPriv::JoinProc saveJoiner = fJoiner; |
| 631 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join); | 632 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join); |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 646 (void) this->conicStroke(conic, &quadPts); | 647 (void) this->conicStroke(conic, &quadPts); |
| 647 this->setConicEndNormal(conic, normalAB, unitAB, &normalBC, &unitBC); | 648 this->setConicEndNormal(conic, normalAB, unitAB, &normalBC, &unitBC); |
| 648 this->postJoinTo(pt2, normalBC, unitBC); | 649 this->postJoinTo(pt2, normalBC, unitBC); |
| 649 } | 650 } |
| 650 | 651 |
| 651 void SkPathStroker::quadTo(const SkPoint& pt1, const SkPoint& pt2) { | 652 void SkPathStroker::quadTo(const SkPoint& pt1, const SkPoint& pt2) { |
| 652 const SkPoint quad[3] = { fPrevPt, pt1, pt2 }; | 653 const SkPoint quad[3] = { fPrevPt, pt1, pt2 }; |
| 653 SkPoint reduction; | 654 SkPoint reduction; |
| 654 ReductionType reductionType = CheckQuadLinear(quad, &reduction); | 655 ReductionType reductionType = CheckQuadLinear(quad, &reduction); |
| 655 if (kPoint_ReductionType == reductionType) { | 656 if (kPoint_ReductionType == reductionType) { |
| 657 this->lineTo(pt2); | |
| 656 return; | 658 return; |
| 657 } | 659 } |
| 658 if (kLine_ReductionType == reductionType) { | 660 if (kLine_ReductionType == reductionType) { |
| 659 this->lineTo(pt2); | 661 this->lineTo(pt2); |
| 660 return; | 662 return; |
| 661 } | 663 } |
| 662 if (kDegenerate_ReductionType == reductionType) { | 664 if (kDegenerate_ReductionType == reductionType) { |
| 663 this->lineTo(reduction); | 665 this->lineTo(reduction); |
| 664 SkStrokerPriv::JoinProc saveJoiner = fJoiner; | 666 SkStrokerPriv::JoinProc saveJoiner = fJoiner; |
| 665 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join); | 667 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join); |
| (...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1161 return true; | 1163 return true; |
| 1162 } | 1164 } |
| 1163 | 1165 |
| 1164 void SkPathStroker::cubicTo(const SkPoint& pt1, const SkPoint& pt2, | 1166 void SkPathStroker::cubicTo(const SkPoint& pt1, const SkPoint& pt2, |
| 1165 const SkPoint& pt3) { | 1167 const SkPoint& pt3) { |
| 1166 const SkPoint cubic[4] = { fPrevPt, pt1, pt2, pt3 }; | 1168 const SkPoint cubic[4] = { fPrevPt, pt1, pt2, pt3 }; |
| 1167 SkPoint reduction[3]; | 1169 SkPoint reduction[3]; |
| 1168 const SkPoint* tangentPt; | 1170 const SkPoint* tangentPt; |
| 1169 ReductionType reductionType = CheckCubicLinear(cubic, reduction, &tangentPt) ; | 1171 ReductionType reductionType = CheckCubicLinear(cubic, reduction, &tangentPt) ; |
| 1170 if (kPoint_ReductionType == reductionType) { | 1172 if (kPoint_ReductionType == reductionType) { |
| 1173 this->lineTo(pt3); | |
| 1171 return; | 1174 return; |
| 1172 } | 1175 } |
| 1173 if (kLine_ReductionType == reductionType) { | 1176 if (kLine_ReductionType == reductionType) { |
| 1174 this->lineTo(pt3); | 1177 this->lineTo(pt3); |
| 1175 return; | 1178 return; |
| 1176 } | 1179 } |
| 1177 if (kDegenerate_ReductionType <= reductionType && kDegenerate3_ReductionType >= reductionType) { | 1180 if (kDegenerate_ReductionType <= reductionType && kDegenerate3_ReductionType >= reductionType) { |
| 1178 this->lineTo(reduction[0]); | 1181 this->lineTo(reduction[0]); |
| 1179 SkStrokerPriv::JoinProc saveJoiner = fJoiner; | 1182 SkStrokerPriv::JoinProc saveJoiner = fJoiner; |
| 1180 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join); | 1183 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1469 default: | 1472 default: |
| 1470 break; | 1473 break; |
| 1471 } | 1474 } |
| 1472 | 1475 |
| 1473 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { | 1476 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { |
| 1474 r = rect; | 1477 r = rect; |
| 1475 r.inset(radius, radius); | 1478 r.inset(radius, radius); |
| 1476 dst->addRect(r, reverse_direction(dir)); | 1479 dst->addRect(r, reverse_direction(dir)); |
| 1477 } | 1480 } |
| 1478 } | 1481 } |
| OLD | NEW |