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

Side by Side Diff: src/core/SkPath.cpp

Issue 22171002: Avoid counting verbs twice in SkPath::isEmpty() (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 | no next file » | 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 this->resetFields(); 373 this->resetFields();
374 } 374 }
375 375
376 bool SkPath::isEmpty() const { 376 bool SkPath::isEmpty() const {
377 SkDEBUGCODE(this->validate();) 377 SkDEBUGCODE(this->validate();)
378 return 0 == fPathRef->countVerbs(); 378 return 0 == fPathRef->countVerbs();
379 } 379 }
380 380
381 bool SkPath::isLine(SkPoint line[2]) const { 381 bool SkPath::isLine(SkPoint line[2]) const {
382 int verbCount = fPathRef->countVerbs(); 382 int verbCount = fPathRef->countVerbs();
383 int ptCount = fPathRef->countVerbs();
384 383
385 if (2 == verbCount && 2 == ptCount) { 384 if (2 == verbCount) {
386 if (kMove_Verb == fPathRef->atVerb(0) && 385 SkASSERT(kMove_Verb == fPathRef->atVerb(0));
387 kLine_Verb == fPathRef->atVerb(1)) { 386 if (kLine_Verb == fPathRef->atVerb(1)) {
387 SkASSERT(2 == fPathRef->countPoints());
388 if (line) { 388 if (line) {
389 const SkPoint* pts = fPathRef->points(); 389 const SkPoint* pts = fPathRef->points();
390 line[0] = pts[0]; 390 line[0] = pts[0];
391 line[1] = pts[1]; 391 line[1] = pts[1];
392 } 392 }
393 return true; 393 return true;
394 } 394 }
395 } 395 }
396 return false; 396 return false;
397 } 397 }
(...skipping 2597 matching lines...) Expand 10 before | Expand all | Expand 10 after
2995 switch (this->getFillType()) { 2995 switch (this->getFillType()) {
2996 case SkPath::kEvenOdd_FillType: 2996 case SkPath::kEvenOdd_FillType:
2997 case SkPath::kInverseEvenOdd_FillType: 2997 case SkPath::kInverseEvenOdd_FillType:
2998 w &= 1; 2998 w &= 1;
2999 break; 2999 break;
3000 default: 3000 default:
3001 break; 3001 break;
3002 } 3002 }
3003 return SkToBool(w); 3003 return SkToBool(w);
3004 } 3004 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698