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

Side by Side 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, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/PathTest.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkBuffer.h" 10 #include "SkBuffer.h"
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 if (!this->cheapComputeDirection(&direction)) { 294 if (!this->cheapComputeDirection(&direction)) {
295 return false; 295 return false;
296 } 296 }
297 297
298 SkPoint firstPt; 298 SkPoint firstPt;
299 SkPoint prevPt; 299 SkPoint prevPt;
300 RawIter iter(*this); 300 RawIter iter(*this);
301 SkPath::Verb verb; 301 SkPath::Verb verb;
302 SkPoint pts[4]; 302 SkPoint pts[4];
303 SkDEBUGCODE(int moveCnt = 0;) 303 SkDEBUGCODE(int moveCnt = 0;)
304 SkDEBUGCODE(int segmentCount = 0;)
305 SkDEBUGCODE(int closeCount = 0;)
304 306
305 while ((verb = iter.next(pts)) != kDone_Verb) { 307 while ((verb = iter.next(pts)) != kDone_Verb) {
306 int nextPt = -1; 308 int nextPt = -1;
307 switch (verb) { 309 switch (verb) {
308 case kMove_Verb: 310 case kMove_Verb:
309 SkASSERT(!moveCnt); 311 SkASSERT(!segmentCount && !closeCount);
310 SkDEBUGCODE(++moveCnt); 312 SkDEBUGCODE(++moveCnt);
311 firstPt = prevPt = pts[0]; 313 firstPt = prevPt = pts[0];
312 break; 314 break;
313 case kLine_Verb: 315 case kLine_Verb:
314 nextPt = 1; 316 nextPt = 1;
315 SkASSERT(moveCnt); 317 SkASSERT(moveCnt && !closeCount);
318 SkDEBUGCODE(++segmentCount);
316 break; 319 break;
317 case kQuad_Verb: 320 case kQuad_Verb:
318 case kConic_Verb: 321 case kConic_Verb:
319 SkASSERT(moveCnt); 322 SkASSERT(moveCnt && !closeCount);
323 SkDEBUGCODE(++segmentCount);
320 nextPt = 2; 324 nextPt = 2;
321 break; 325 break;
322 case kCubic_Verb: 326 case kCubic_Verb:
323 SkASSERT(moveCnt); 327 SkASSERT(moveCnt && !closeCount);
328 SkDEBUGCODE(++segmentCount);
324 nextPt = 3; 329 nextPt = 3;
325 break; 330 break;
326 case kClose_Verb: 331 case kClose_Verb:
332 SkDEBUGCODE(++closeCount;)
327 break; 333 break;
328 default: 334 default:
329 SkDEBUGFAIL("unknown verb"); 335 SkDEBUGFAIL("unknown verb");
330 } 336 }
331 if (-1 != nextPt) { 337 if (-1 != nextPt) {
332 if (!check_edge_against_rect(prevPt, pts[nextPt], rect, direction)) { 338 if (!check_edge_against_rect(prevPt, pts[nextPt], rect, direction)) {
333 return false; 339 return false;
334 } 340 }
335 prevPt = pts[nextPt]; 341 prevPt = pts[nextPt];
336 } 342 }
(...skipping 2652 matching lines...) Expand 10 before | Expand all | Expand 10 after
2989 switch (this->getFillType()) { 2995 switch (this->getFillType()) {
2990 case SkPath::kEvenOdd_FillType: 2996 case SkPath::kEvenOdd_FillType:
2991 case SkPath::kInverseEvenOdd_FillType: 2997 case SkPath::kInverseEvenOdd_FillType:
2992 w &= 1; 2998 w &= 1;
2993 break; 2999 break;
2994 default: 3000 default:
2995 break; 3001 break;
2996 } 3002 }
2997 return SkToBool(w); 3003 return SkToBool(w);
2998 } 3004 }
OLDNEW
« 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