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

Side by Side Diff: tests/PathOpsAngleTest.cpp

Issue 1250293002: fix path ops fuzz buster (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: corrupting bug kaput Created 5 years, 5 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 | « tests/PathOpsAngleIdeas.cpp ('k') | tests/PathOpsBuilderTest.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 2013 Google Inc. 2 * Copyright 2013 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 "PathOpsTestCommon.h" 7 #include "PathOpsTestCommon.h"
8 #include "SkIntersections.h" 8 #include "SkIntersections.h"
9 #include "SkOpContour.h" 9 #include "SkOpContour.h"
10 #include "SkOpSegment.h" 10 #include "SkOpSegment.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 { {{{313.0155029296875, 207.90290832519531}, {320.05078125, 227.587432861328 12}}}, 2, {} }, 228 { {{{313.0155029296875, 207.90290832519531}, {320.05078125, 227.587432861328 12}}}, 2, {} },
229 { {{{313.0155029296875, 207.90290832519531}, {313.98246891063195, 219.336152 03830394}, 229 { {{{313.0155029296875, 207.90290832519531}, {313.98246891063195, 219.336152 03830394},
230 {320.05078125, 227.58743286132812}}}, 3, {} }, 230 {320.05078125, 227.58743286132812}}}, 3, {} },
231 }; 231 };
232 232
233 static const int circleDataSetSize = (int) SK_ARRAY_COUNT(circleDataSet); 233 static const int circleDataSetSize = (int) SK_ARRAY_COUNT(circleDataSet);
234 234
235 DEF_TEST(PathOpsAngleCircle, reporter) { 235 DEF_TEST(PathOpsAngleCircle, reporter) {
236 SkChunkAlloc allocator(4096); 236 SkChunkAlloc allocator(4096);
237 SkOpContourHead contour; 237 SkOpContourHead contour;
238 SkOpGlobalState state(NULL, &contour); 238 SkOpGlobalState state(NULL, &contour SkDEBUGPARAMS(NULL));
239 contour.init(&state, false, false); 239 contour.init(&state, false, false);
240 for (int index = 0; index < circleDataSetSize; ++index) { 240 for (int index = 0; index < circleDataSetSize; ++index) {
241 CircleData& data = circleDataSet[index]; 241 CircleData& data = circleDataSet[index];
242 for (int idx2 = 0; idx2 < data.fPtCount; ++idx2) { 242 for (int idx2 = 0; idx2 < data.fPtCount; ++idx2) {
243 data.fShortPts[idx2] = data.fPts.fPts[idx2].asSkPoint(); 243 data.fShortPts[idx2] = data.fPts.fPts[idx2].asSkPoint();
244 } 244 }
245 switch (data.fPtCount) { 245 switch (data.fPtCount) {
246 case 2: 246 case 2:
247 contour.addLine(data.fShortPts, &allocator); 247 contour.addLine(data.fShortPts, &allocator);
248 break; 248 break;
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 420
421 static const int intersectDataSetsSize = (int) SK_ARRAY_COUNT(intersectDataSetSi zes); 421 static const int intersectDataSetsSize = (int) SK_ARRAY_COUNT(intersectDataSetSi zes);
422 422
423 struct FourPoints { 423 struct FourPoints {
424 SkPoint pts[4]; 424 SkPoint pts[4];
425 }; 425 };
426 426
427 DEF_TEST(PathOpsAngleAfter, reporter) { 427 DEF_TEST(PathOpsAngleAfter, reporter) {
428 SkChunkAlloc allocator(4096); 428 SkChunkAlloc allocator(4096);
429 SkOpContourHead contour; 429 SkOpContourHead contour;
430 SkOpGlobalState state(NULL, &contour); 430 SkOpGlobalState state(NULL, &contour SkDEBUGPARAMS(NULL));
431 contour.init(&state, false, false); 431 contour.init(&state, false, false);
432 for (int index = intersectDataSetsSize - 1; index >= 0; --index) { 432 for (int index = intersectDataSetsSize - 1; index >= 0; --index) {
433 IntersectData* dataArray = intersectDataSets[index]; 433 IntersectData* dataArray = intersectDataSets[index];
434 const int dataSize = intersectDataSetSizes[index]; 434 const int dataSize = intersectDataSetSizes[index];
435 for (int index2 = 0; index2 < dataSize - 2; ++index2) { 435 for (int index2 = 0; index2 < dataSize - 2; ++index2) {
436 allocator.reset(); 436 allocator.reset();
437 contour.reset(); 437 contour.reset();
438 for (int index3 = 0; index3 < 3; ++index3) { 438 for (int index3 = 0; index3 < 3; ++index3) {
439 IntersectData& data = dataArray[index2 + index3]; 439 IntersectData& data = dataArray[index2 + index3];
440 SkPoint* temp = (SkPoint*) SkOpTAllocator<FourPoints>::Allocate( &allocator); 440 SkPoint* temp = (SkPoint*) SkOpTAllocator<FourPoints>::Allocate( &allocator);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 488 }
489 angle->set(startSpan, endSpan); 489 angle->set(startSpan, endSpan);
490 if (startT < endT) { 490 if (startT < endT) {
491 startSpan->upCast()->setToAngle(angle); 491 startSpan->upCast()->setToAngle(angle);
492 endSpan->setFromAngle(angle); 492 endSpan->setFromAngle(angle);
493 } else { 493 } else {
494 endSpan->upCast()->setToAngle(angle); 494 endSpan->upCast()->setToAngle(angle);
495 startSpan->setFromAngle(angle); 495 startSpan->setFromAngle(angle);
496 } 496 }
497 } 497 }
OLDNEW
« no previous file with comments | « tests/PathOpsAngleIdeas.cpp ('k') | tests/PathOpsBuilderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698