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

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

Issue 948043002: break out of cubic stroker loop on degenerate case (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 | « no previous file | no next file » | 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 "SkPath.h" 10 #include "SkPath.h"
(...skipping 1393 matching lines...) Expand 10 before | Expand all | Expand 10 after
1404 SkASSERT(kQuad_ReductionType == reductionType); 1404 SkASSERT(kQuad_ReductionType == reductionType);
1405 SkVector normalAB, unitAB, normalCD, unitCD; 1405 SkVector normalAB, unitAB, normalCD, unitCD;
1406 this->preJoinTo(*tangentPt, &normalAB, &unitAB, false); 1406 this->preJoinTo(*tangentPt, &normalAB, &unitAB, false);
1407 SkScalar tValues[2]; 1407 SkScalar tValues[2];
1408 int count = SkFindCubicInflections(cubic, tValues); 1408 int count = SkFindCubicInflections(cubic, tValues);
1409 SkScalar lastT = 0; 1409 SkScalar lastT = 0;
1410 for (int index = 0; index <= count; ++index) { 1410 for (int index = 0; index <= count; ++index) {
1411 SkScalar nextT = index < count ? tValues[index] : 1; 1411 SkScalar nextT = index < count ? tValues[index] : 1;
1412 SkQuadConstruct quadPts; 1412 SkQuadConstruct quadPts;
1413 this->init(kOuter_StrokeType, &quadPts, lastT, nextT); 1413 this->init(kOuter_StrokeType, &quadPts, lastT, nextT);
1414 if (!this->cubicStroke(cubic, &quadPts)) { 1414 if (!this->cubicStroke(cubic, &quadPts)) {
reed1 2015/02/23 15:44:12 Can we add a brief comment as to why this might oc
caryclark 2015/02/23 17:10:47 Done.
1415 return; 1415 break;
1416 } 1416 }
1417 this->init(kInner_StrokeType, &quadPts, lastT, nextT); 1417 this->init(kInner_StrokeType, &quadPts, lastT, nextT);
1418 if (!this->cubicStroke(cubic, &quadPts)) { 1418 if (!this->cubicStroke(cubic, &quadPts)) {
1419 return; 1419 break;
1420 } 1420 }
1421 lastT = nextT; 1421 lastT = nextT;
1422 } 1422 }
1423 this->setCubicEndNormal(cubic, normalAB, unitAB, &normalCD, &unitCD); 1423 this->setCubicEndNormal(cubic, normalAB, unitAB, &normalCD, &unitCD);
1424 #else 1424 #else
1425 bool degenerateAB = SkPath::IsLineDegenerate(fPrevPt, pt1); 1425 bool degenerateAB = SkPath::IsLineDegenerate(fPrevPt, pt1);
1426 bool degenerateBC = SkPath::IsLineDegenerate(pt1, pt2); 1426 bool degenerateBC = SkPath::IsLineDegenerate(pt1, pt2);
1427 bool degenerateCD = SkPath::IsLineDegenerate(pt2, pt3); 1427 bool degenerateCD = SkPath::IsLineDegenerate(pt2, pt3);
1428 1428
1429 if (degenerateAB + degenerateBC + degenerateCD >= 2 1429 if (degenerateAB + degenerateBC + degenerateCD >= 2
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 default: 1736 default:
1737 break; 1737 break;
1738 } 1738 }
1739 1739
1740 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) { 1740 if (fWidth < SkMinScalar(rw, rh) && !fDoFill) {
1741 r = rect; 1741 r = rect;
1742 r.inset(radius, radius); 1742 r.inset(radius, radius);
1743 dst->addRect(r, reverse_direction(dir)); 1743 dst->addRect(r, reverse_direction(dir));
1744 } 1744 }
1745 } 1745 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698