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

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

Issue 2103903004: fix fuzz test that exceeds numeric limit (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 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 | « no previous file | src/pathops/SkPathOpsTSect.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 "SkOpCoincidence.h" 7 #include "SkOpCoincidence.h"
8 #include "SkOpContour.h" 8 #include "SkOpContour.h"
9 #include "SkOpSegment.h" 9 #include "SkOpSegment.h"
10 #include "SkPathWriter.h" 10 #include "SkPathWriter.h"
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 SkOpSpanBase* foundSpan; 1123 SkOpSpanBase* foundSpan;
1124 SkOpSpanBase* otherEnd; 1124 SkOpSpanBase* otherEnd;
1125 SkOpSegment* other; 1125 SkOpSegment* other;
1126 if (angle == nullptr) { 1126 if (angle == nullptr) {
1127 if (endSpan->t() != 0 && endSpan->t() != 1) { 1127 if (endSpan->t() != 0 && endSpan->t() != 1) {
1128 return nullptr; 1128 return nullptr;
1129 } 1129 }
1130 SkOpPtT* otherPtT = endSpan->ptT()->next(); 1130 SkOpPtT* otherPtT = endSpan->ptT()->next();
1131 other = otherPtT->segment(); 1131 other = otherPtT->segment();
1132 foundSpan = otherPtT->span(); 1132 foundSpan = otherPtT->span();
1133 otherEnd = step > 0 ? foundSpan->upCast()->next() : foundSpan->prev(); 1133 otherEnd = step > 0
1134 ? foundSpan->upCastable() ? foundSpan->upCast()->next() : nullpt r
mmoroz 2016/06/29 14:52:35 Not sure if it is a good idea to use a nested tern
1135 : foundSpan->prev();
1134 } else { 1136 } else {
1135 int loopCount = angle->loopCount(); 1137 int loopCount = angle->loopCount();
1136 if (loopCount > 2) { 1138 if (loopCount > 2) {
1137 return set_last(last, endSpan); 1139 return set_last(last, endSpan);
1138 } 1140 }
1139 const SkOpAngle* next = angle->next(); 1141 const SkOpAngle* next = angle->next();
1140 if (nullptr == next) { 1142 if (nullptr == next) {
1141 return nullptr; 1143 return nullptr;
1142 } 1144 }
1143 #if DEBUG_WINDING 1145 #if DEBUG_WINDING
1144 if (angle->debugSign() != next->debugSign() && !angle->segment()->contou r()->isXor() 1146 if (angle->debugSign() != next->debugSign() && !angle->segment()->contou r()->isXor()
1145 && !next->segment()->contour()->isXor()) { 1147 && !next->segment()->contour()->isXor()) {
1146 SkDebugf("%s mismatched signs\n", __FUNCTION__); 1148 SkDebugf("%s mismatched signs\n", __FUNCTION__);
1147 } 1149 }
1148 #endif 1150 #endif
1149 other = next->segment(); 1151 other = next->segment();
1150 foundSpan = endSpan = next->start(); 1152 foundSpan = endSpan = next->start();
1151 otherEnd = next->end(); 1153 otherEnd = next->end();
1152 } 1154 }
1155 if (!otherEnd) {
1156 return nullptr;
1157 }
1153 int foundStep = foundSpan->step(otherEnd); 1158 int foundStep = foundSpan->step(otherEnd);
1154 if (*stepPtr != foundStep) { 1159 if (*stepPtr != foundStep) {
1155 return set_last(last, endSpan); 1160 return set_last(last, endSpan);
1156 } 1161 }
1157 SkASSERT(*startPtr); 1162 SkASSERT(*startPtr);
1158 if (!otherEnd) { 1163 if (!otherEnd) {
1159 return nullptr; 1164 return nullptr;
1160 } 1165 }
1161 // SkASSERT(otherEnd >= 0); 1166 // SkASSERT(otherEnd >= 0);
1162 SkOpSpan* origMin = step < 0 ? origStart->prev() : origStart->upCast(); 1167 SkOpSpan* origMin = step < 0 ? origStart->prev() : origStart->upCast();
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after
1778 int absOut = SkTAbs(outerWinding); 1783 int absOut = SkTAbs(outerWinding);
1779 int absIn = SkTAbs(innerWinding); 1784 int absIn = SkTAbs(innerWinding);
1780 bool result = absOut == absIn ? outerWinding < 0 : absOut < absIn; 1785 bool result = absOut == absIn ? outerWinding < 0 : absOut < absIn;
1781 return result; 1786 return result;
1782 } 1787 }
1783 1788
1784 int SkOpSegment::windSum(const SkOpAngle* angle) const { 1789 int SkOpSegment::windSum(const SkOpAngle* angle) const {
1785 const SkOpSpan* minSpan = angle->start()->starter(angle->end()); 1790 const SkOpSpan* minSpan = angle->start()->starter(angle->end());
1786 return minSpan->windSum(); 1791 return minSpan->windSum();
1787 } 1792 }
OLDNEW
« no previous file with comments | « no previous file | src/pathops/SkPathOpsTSect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698