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

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

Issue 138703008: fix minor error between kStroke_PathAsRect and kFill_PathAsRect in SkPath::asRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 10 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 | « include/core/SkPath.h ('k') | 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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 *isClosed = autoClose; 499 *isClosed = autoClose;
500 } 500 }
501 if (result && direction) { 501 if (result && direction) {
502 *direction = firstDirection == ((lastDirection + 1) & 3) ? kCCW_Directio n : kCW_Direction; 502 *direction = firstDirection == ((lastDirection + 1) & 3) ? kCCW_Directio n : kCW_Direction;
503 } 503 }
504 return result; 504 return result;
505 } 505 }
506 506
507 SkPath::PathAsRect SkPath::asRect(Direction* direction) const { 507 SkPath::PathAsRect SkPath::asRect(Direction* direction) const {
508 SK_COMPILE_ASSERT(0 == kNone_PathAsRect, path_as_rect_mismatch); 508 SK_COMPILE_ASSERT(0 == kNone_PathAsRect, path_as_rect_mismatch);
509 SK_COMPILE_ASSERT(1 == kStroke_PathAsRect, path_as_rect_mismatch); 509 SK_COMPILE_ASSERT(1 == kFill_PathAsRect, path_as_rect_mismatch);
510 SK_COMPILE_ASSERT(2 == kFill_PathAsRect, path_as_rect_mismatch); 510 SK_COMPILE_ASSERT(2 == kStroke_PathAsRect, path_as_rect_mismatch);
511 bool isClosed = false; 511 bool isClosed = false;
512 return (PathAsRect) (isRect(&isClosed, direction) + isClosed); 512 return (PathAsRect) (isRect(&isClosed, direction) + isClosed);
yunchao 2014/02/08 07:10:48 kFill_PathAsRect is added for those non-closed pat
513 } 513 }
514 514
515 bool SkPath::isRect(SkRect* rect) const { 515 bool SkPath::isRect(SkRect* rect) const {
516 SkDEBUGCODE(this->validate();) 516 SkDEBUGCODE(this->validate();)
517 int currVerb = 0; 517 int currVerb = 0;
518 const SkPoint* pts = fPathRef->points(); 518 const SkPoint* pts = fPathRef->points();
519 bool result = isRectContour(false, &currVerb, &pts, NULL, NULL); 519 bool result = isRectContour(false, &currVerb, &pts, NULL, NULL);
520 if (result && rect) { 520 if (result && rect) {
521 *rect = getBounds(); 521 *rect = getBounds();
522 } 522 }
(...skipping 2358 matching lines...) Expand 10 before | Expand all | Expand 10 after
2881 switch (this->getFillType()) { 2881 switch (this->getFillType()) {
2882 case SkPath::kEvenOdd_FillType: 2882 case SkPath::kEvenOdd_FillType:
2883 case SkPath::kInverseEvenOdd_FillType: 2883 case SkPath::kInverseEvenOdd_FillType:
2884 w &= 1; 2884 w &= 1;
2885 break; 2885 break;
2886 default: 2886 default:
2887 break; 2887 break;
2888 } 2888 }
2889 return SkToBool(w); 2889 return SkToBool(w);
2890 } 2890 }
OLDNEW
« no previous file with comments | « include/core/SkPath.h ('k') | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698