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

Side by Side Diff: src/pathops/SkOpEdgeBuilder.cpp

Issue 1921173003: pathops: Cosmetic only change, update comments around ComplexBreak(). (Closed) Base URL: https://skia.googlesource.com/skia.git/@master
Patch Set: Created 4 years, 7 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 2012 Google Inc. 2 * Copyright 2012 Google Inc.
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 #include "SkGeometry.h" 7 #include "SkGeometry.h"
8 #include "SkOpEdgeBuilder.h" 8 #include "SkOpEdgeBuilder.h"
9 #include "SkReduceOrder.h" 9 #include "SkReduceOrder.h"
10 10
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 case SkPath::kLine_Verb: 192 case SkPath::kLine_Verb:
193 fCurrentContour->addLine(pointsPtr, fAllocator); 193 fCurrentContour->addLine(pointsPtr, fAllocator);
194 break; 194 break;
195 case SkPath::kQuad_Verb: 195 case SkPath::kQuad_Verb:
196 fCurrentContour->addQuad(pointsPtr, fAllocator); 196 fCurrentContour->addQuad(pointsPtr, fAllocator);
197 break; 197 break;
198 case SkPath::kConic_Verb: 198 case SkPath::kConic_Verb:
199 fCurrentContour->addConic(pointsPtr, *weightPtr++, fAllocator); 199 fCurrentContour->addConic(pointsPtr, *weightPtr++, fAllocator);
200 break; 200 break;
201 case SkPath::kCubic_Verb: { 201 case SkPath::kCubic_Verb: {
202 // split self-intersecting cubics in two before proceeding 202 // Split complex cubics (such as self-intersecting curves or
203 // if the cubic is convex, it doesn't self intersect. 203 // ones with difficult curvature) in two before proceeding.
204 SkScalar loopT; 204 // This can be required for intersection to succeed.
205 if (SkDCubic::ComplexBreak(pointsPtr, &loopT)) { 205 SkScalar splitT;
206 SkPoint cubicPair[7]; 206 if (SkDCubic::ComplexBreak(pointsPtr, &splitT)) {
207 SkChopCubicAt(pointsPtr, cubicPair, loopT); 207 SkPoint cubicPair[7];
208 SkChopCubicAt(pointsPtr, cubicPair, splitT);
208 if (!SkScalarsAreFinite(&cubicPair[0].fX, SK_ARRAY_COUNT(cub icPair) * 2)) { 209 if (!SkScalarsAreFinite(&cubicPair[0].fX, SK_ARRAY_COUNT(cub icPair) * 2)) {
209 return false; 210 return false;
210 } 211 }
211 SkPoint cStorage[2][4]; 212 SkPoint cStorage[2][4];
212 SkPath::Verb v1 = SkReduceOrder::Cubic(&cubicPair[0], cStora ge[0]); 213 SkPath::Verb v1 = SkReduceOrder::Cubic(&cubicPair[0], cStora ge[0]);
213 SkPath::Verb v2 = SkReduceOrder::Cubic(&cubicPair[3], cStora ge[1]); 214 SkPath::Verb v2 = SkReduceOrder::Cubic(&cubicPair[3], cStora ge[1]);
214 if (v1 != SkPath::kMove_Verb && v2 != SkPath::kMove_Verb) { 215 if (v1 != SkPath::kMove_Verb && v2 != SkPath::kMove_Verb) {
215 SkPoint* curve1 = v1 == SkPath::kCubic_Verb ? &cubicPair [0] : cStorage[0]; 216 SkPoint* curve1 = v1 == SkPath::kCubic_Verb ? &cubicPair [0] : cStorage[0];
216 SkPoint* curve2 = v2 == SkPath::kCubic_Verb ? &cubicPair [3] : cStorage[1]; 217 SkPoint* curve2 = v2 == SkPath::kCubic_Verb ? &cubicPair [3] : cStorage[1];
217 for (int index = 0; index < SkPathOpsVerbToPoints(v1); + +index) { 218 for (int index = 0; index < SkPathOpsVerbToPoints(v1); + +index) {
(...skipping 23 matching lines...) Expand all
241 } 242 }
242 SkASSERT(fCurrentContour); 243 SkASSERT(fCurrentContour);
243 fCurrentContour->debugValidate(); 244 fCurrentContour->debugValidate();
244 pointsPtr += SkPathOpsVerbToPoints(verb); 245 pointsPtr += SkPathOpsVerbToPoints(verb);
245 } 246 }
246 if (fCurrentContour && fCurrentContour->count() &&!fAllowOpenContours && !clo se()) { 247 if (fCurrentContour && fCurrentContour->count() &&!fAllowOpenContours && !clo se()) {
247 return false; 248 return false;
248 } 249 }
249 return true; 250 return true;
250 } 251 }
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