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

Unified Diff: src/core/SkPath.cpp

Issue 21565002: Make SkPath::conservativelyContainsRect not assert on paths that begin with repeated moveTos (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/PathTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPath.cpp
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index b28518425ee655bcb1d6df48660a009d8d219a30..d1e4d79179003a66c02cbbac0c5d49363f2d4194 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -301,29 +301,35 @@ bool SkPath::conservativelyContainsRect(const SkRect& rect) const {
SkPath::Verb verb;
SkPoint pts[4];
SkDEBUGCODE(int moveCnt = 0;)
+ SkDEBUGCODE(int segmentCount = 0;)
+ SkDEBUGCODE(int closeCount = 0;)
while ((verb = iter.next(pts)) != kDone_Verb) {
int nextPt = -1;
switch (verb) {
case kMove_Verb:
- SkASSERT(!moveCnt);
+ SkASSERT(!segmentCount && !closeCount);
SkDEBUGCODE(++moveCnt);
firstPt = prevPt = pts[0];
break;
case kLine_Verb:
nextPt = 1;
- SkASSERT(moveCnt);
+ SkASSERT(moveCnt && !closeCount);
+ SkDEBUGCODE(++segmentCount);
break;
case kQuad_Verb:
case kConic_Verb:
- SkASSERT(moveCnt);
+ SkASSERT(moveCnt && !closeCount);
+ SkDEBUGCODE(++segmentCount);
nextPt = 2;
break;
case kCubic_Verb:
- SkASSERT(moveCnt);
+ SkASSERT(moveCnt && !closeCount);
+ SkDEBUGCODE(++segmentCount);
nextPt = 3;
break;
case kClose_Verb:
+ SkDEBUGCODE(++closeCount;)
break;
default:
SkDEBUGFAIL("unknown verb");
« no previous file with comments | « no previous file | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698