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

Side by Side Diff: src/pathops/SkPathOpsTightBounds.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 | « src/pathops/SkPathOpsSimplify.cpp ('k') | src/pathops/SkPathOpsTypes.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 2014 Google Inc. 2 * Copyright 2014 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 "SkOpEdgeBuilder.h" 7 #include "SkOpEdgeBuilder.h"
8 #include "SkPathOpsCommon.h" 8 #include "SkPathOpsCommon.h"
9 9
10 bool TightBounds(const SkPath& path, SkRect* result) { 10 bool TightBounds(const SkPath& path, SkRect* result) {
11 SkChunkAlloc allocator(4096); // FIXME: constant-ize, tune 11 SkChunkAlloc allocator(4096); // FIXME: constant-ize, tune
12 SkOpContour contour; 12 SkOpContour contour;
13 SkOpContourHead* contourList = static_cast<SkOpContourHead*>(&contour); 13 SkOpContourHead* contourList = static_cast<SkOpContourHead*>(&contour);
14 SkOpGlobalState globalState(NULL, contourList); 14 SkOpGlobalState globalState(NULL, contourList SkDEBUGPARAMS(NULL));
15 // turn path into list of segments 15 // turn path into list of segments
16 SkOpEdgeBuilder builder(path, &contour, &allocator, &globalState); 16 SkOpEdgeBuilder builder(path, &contour, &allocator, &globalState);
17 if (!builder.finish(&allocator)) { 17 if (!builder.finish(&allocator)) {
18 return false; 18 return false;
19 } 19 }
20 if (!SortContourList(&contourList, false, false)) { 20 if (!SortContourList(&contourList, false, false)) {
21 result->setEmpty(); 21 result->setEmpty();
22 return true; 22 return true;
23 } 23 }
24 SkOpContour* current = contourList; 24 SkOpContour* current = contourList;
25 SkPathOpsBounds bounds = current->bounds(); 25 SkPathOpsBounds bounds = current->bounds();
26 while ((current = current->next())) { 26 while ((current = current->next())) {
27 bounds.add(current->bounds()); 27 bounds.add(current->bounds());
28 } 28 }
29 *result = bounds; 29 *result = bounds;
30 return true; 30 return true;
31 } 31 }
OLDNEW
« no previous file with comments | « src/pathops/SkPathOpsSimplify.cpp ('k') | src/pathops/SkPathOpsTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698