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

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

Issue 1334543002: Revert of more zero-length changes for svg compatibility (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 3 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 | « src/core/SkCanvas.cpp ('k') | tests/EmptyPathTest.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 * 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
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);
626 return; 622 return;
627 } 623 }
628 if (kLine_ReductionType == reductionType) { 624 if (kLine_ReductionType == reductionType) {
629 this->lineTo(pt2); 625 this->lineTo(pt2);
630 return; 626 return;
631 } 627 }
632 if (kDegenerate_ReductionType == reductionType) { 628 if (kDegenerate_ReductionType == reductionType) {
633 this->lineTo(reduction); 629 this->lineTo(reduction);
634 SkStrokerPriv::JoinProc saveJoiner = fJoiner; 630 SkStrokerPriv::JoinProc saveJoiner = fJoiner;
635 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join); 631 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join);
(...skipping 14 matching lines...) Expand all
650 (void) this->conicStroke(conic, &quadPts); 646 (void) this->conicStroke(conic, &quadPts);
651 this->setConicEndNormal(conic, normalAB, unitAB, &normalBC, &unitBC); 647 this->setConicEndNormal(conic, normalAB, unitAB, &normalBC, &unitBC);
652 this->postJoinTo(pt2, normalBC, unitBC); 648 this->postJoinTo(pt2, normalBC, unitBC);
653 } 649 }
654 650
655 void SkPathStroker::quadTo(const SkPoint& pt1, const SkPoint& pt2) { 651 void SkPathStroker::quadTo(const SkPoint& pt1, const SkPoint& pt2) {
656 const SkPoint quad[3] = { fPrevPt, pt1, pt2 }; 652 const SkPoint quad[3] = { fPrevPt, pt1, pt2 };
657 SkPoint reduction; 653 SkPoint reduction;
658 ReductionType reductionType = CheckQuadLinear(quad, &reduction); 654 ReductionType reductionType = CheckQuadLinear(quad, &reduction);
659 if (kPoint_ReductionType == reductionType) { 655 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);
664 return; 656 return;
665 } 657 }
666 if (kLine_ReductionType == reductionType) { 658 if (kLine_ReductionType == reductionType) {
667 this->lineTo(pt2); 659 this->lineTo(pt2);
668 return; 660 return;
669 } 661 }
670 if (kDegenerate_ReductionType == reductionType) { 662 if (kDegenerate_ReductionType == reductionType) {
671 this->lineTo(reduction); 663 this->lineTo(reduction);
672 SkStrokerPriv::JoinProc saveJoiner = fJoiner; 664 SkStrokerPriv::JoinProc saveJoiner = fJoiner;
673 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join); 665 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join);
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 return true; 1161 return true;
1170 } 1162 }
1171 1163
1172 void SkPathStroker::cubicTo(const SkPoint& pt1, const SkPoint& pt2, 1164 void SkPathStroker::cubicTo(const SkPoint& pt1, const SkPoint& pt2,
1173 const SkPoint& pt3) { 1165 const SkPoint& pt3) {
1174 const SkPoint cubic[4] = { fPrevPt, pt1, pt2, pt3 }; 1166 const SkPoint cubic[4] = { fPrevPt, pt1, pt2, pt3 };
1175 SkPoint reduction[3]; 1167 SkPoint reduction[3];
1176 const SkPoint* tangentPt; 1168 const SkPoint* tangentPt;
1177 ReductionType reductionType = CheckCubicLinear(cubic, reduction, &tangentPt) ; 1169 ReductionType reductionType = CheckCubicLinear(cubic, reduction, &tangentPt) ;
1178 if (kPoint_ReductionType == reductionType) { 1170 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);
1183 return; 1171 return;
1184 } 1172 }
1185 if (kLine_ReductionType == reductionType) { 1173 if (kLine_ReductionType == reductionType) {
1186 this->lineTo(pt3); 1174 this->lineTo(pt3);
1187 return; 1175 return;
1188 } 1176 }
1189 if (kDegenerate_ReductionType <= reductionType && kDegenerate3_ReductionType >= reductionType) { 1177 if (kDegenerate_ReductionType <= reductionType && kDegenerate3_ReductionType >= reductionType) {
1190 this->lineTo(reduction[0]); 1178 this->lineTo(reduction[0]);
1191 SkStrokerPriv::JoinProc saveJoiner = fJoiner; 1179 SkStrokerPriv::JoinProc saveJoiner = fJoiner;
1192 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join); 1180 fJoiner = SkStrokerPriv::JoinFactory(SkPaint::kRound_Join);
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 default: 1469 default:
1482 break; 1470 break;
1483 } 1471 }
1484 1472
1485 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { 1473 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) {
1486 r = rect; 1474 r = rect;
1487 r.inset(radius, radius); 1475 r.inset(radius, radius);
1488 dst->addRect(r, reverse_direction(dir)); 1476 dst->addRect(r, reverse_direction(dir));
1489 } 1477 }
1490 } 1478 }
OLDNEW
« no previous file with comments | « src/core/SkCanvas.cpp ('k') | tests/EmptyPathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698