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

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

Issue 1322413002: remove unused fields from SkOpSegment (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/pathops/SkOpContour.h ('k') | src/pathops/SkOpSegment.h » ('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 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 self-intersecting cubics in two before proceeding
203 // if the cubic is convex, it doesn't self intersect. 203 // if the cubic is convex, it doesn't self intersect.
204 SkScalar loopT; 204 SkScalar loopT;
205 SkDCubic::CubicType cubicType; 205 if (SkDCubic::ComplexBreak(pointsPtr, &loopT)) {
206 if (SkDCubic::ComplexBreak(pointsPtr, &loopT, &cubicType)) {
207 SkPoint cubicPair[7]; 206 SkPoint cubicPair[7];
208 SkChopCubicAt(pointsPtr, cubicPair, loopT); 207 SkChopCubicAt(pointsPtr, cubicPair, loopT);
209 if (!SkScalarsAreFinite(&cubicPair[0].fX, SK_ARRAY_COUNT(cub icPair) * 2)) { 208 if (!SkScalarsAreFinite(&cubicPair[0].fX, SK_ARRAY_COUNT(cub icPair) * 2)) {
210 return false; 209 return false;
211 } 210 }
212 SkPoint cStorage[2][4]; 211 SkPoint cStorage[2][4];
213 SkPath::Verb v1 = SkReduceOrder::Cubic(&cubicPair[0], cStora ge[0]); 212 SkPath::Verb v1 = SkReduceOrder::Cubic(&cubicPair[0], cStora ge[0]);
214 SkPath::Verb v2 = SkReduceOrder::Cubic(&cubicPair[3], cStora ge[1]); 213 SkPath::Verb v2 = SkReduceOrder::Cubic(&cubicPair[3], cStora ge[1]);
215 if (v1 != SkPath::kMove_Verb && v2 != SkPath::kMove_Verb) { 214 if (v1 != SkPath::kMove_Verb && v2 != SkPath::kMove_Verb) {
216 SkPoint* curve1 = v1 == SkPath::kCubic_Verb ? &cubicPair [0] : cStorage[0]; 215 SkPoint* curve1 = v1 == SkPath::kCubic_Verb ? &cubicPair [0] : cStorage[0];
217 SkPoint* curve2 = v2 == SkPath::kCubic_Verb ? &cubicPair [3] : cStorage[1]; 216 SkPoint* curve2 = v2 == SkPath::kCubic_Verb ? &cubicPair [3] : cStorage[1];
218 for (int index = 0; index < SkPathOpsVerbToPoints(v1); + +index) { 217 for (int index = 0; index < SkPathOpsVerbToPoints(v1); + +index) {
219 force_small_to_zero(&curve1[index]); 218 force_small_to_zero(&curve1[index]);
220 } 219 }
221 for (int index = 0; index < SkPathOpsVerbToPoints(v2); + +index) { 220 for (int index = 0; index < SkPathOpsVerbToPoints(v2); + +index) {
222 force_small_to_zero(&curve2[index]); 221 force_small_to_zero(&curve2[index]);
223 } 222 }
224 fCurrentContour->addCurve(v1, curve1, fAllocator)->setCu bicType(cubicType); 223 fCurrentContour->addCurve(v1, curve1, fAllocator);
225 fCurrentContour->addCurve(v2, curve2, fAllocator)->setCu bicType(cubicType); 224 fCurrentContour->addCurve(v2, curve2, fAllocator);
226 } else { 225 } else {
227 fCurrentContour->addCubic(pointsPtr, fAllocator); 226 fCurrentContour->addCubic(pointsPtr, fAllocator);
228 } 227 }
229 } else { 228 } else {
230 fCurrentContour->addCubic(pointsPtr, fAllocator); 229 fCurrentContour->addCubic(pointsPtr, fAllocator);
231 } 230 }
232 } break; 231 } break;
233 case SkPath::kClose_Verb: 232 case SkPath::kClose_Verb:
234 SkASSERT(fCurrentContour); 233 SkASSERT(fCurrentContour);
235 if (!close()) { 234 if (!close()) {
236 return false; 235 return false;
237 } 236 }
238 continue; 237 continue;
239 default: 238 default:
240 SkDEBUGFAIL("bad verb"); 239 SkDEBUGFAIL("bad verb");
241 return false; 240 return false;
242 } 241 }
243 SkASSERT(fCurrentContour); 242 SkASSERT(fCurrentContour);
244 fCurrentContour->debugValidate(); 243 fCurrentContour->debugValidate();
245 pointsPtr += SkPathOpsVerbToPoints(verb); 244 pointsPtr += SkPathOpsVerbToPoints(verb);
246 } 245 }
247 if (fCurrentContour && fCurrentContour->count() &&!fAllowOpenContours && !clo se()) { 246 if (fCurrentContour && fCurrentContour->count() &&!fAllowOpenContours && !clo se()) {
248 return false; 247 return false;
249 } 248 }
250 return true; 249 return true;
251 } 250 }
OLDNEW
« no previous file with comments | « src/pathops/SkOpContour.h ('k') | src/pathops/SkOpSegment.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698