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

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

Issue 833193002: Remove SkPath::asRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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 | « src/core/SkClipStack.cpp ('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 * Copyright 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 7
8 #include "SkBuffer.h" 8 #include "SkBuffer.h"
9 #include "SkErrorInternals.h" 9 #include "SkErrorInternals.h"
10 #include "SkGeometry.h" 10 #include "SkGeometry.h"
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
519 } 519 }
520 if (result && isClosed) { 520 if (result && isClosed) {
521 *isClosed = autoClose; 521 *isClosed = autoClose;
522 } 522 }
523 if (result && direction) { 523 if (result && direction) {
524 *direction = firstDirection == ((lastDirection + 1) & 3) ? kCCW_Directio n : kCW_Direction; 524 *direction = firstDirection == ((lastDirection + 1) & 3) ? kCCW_Directio n : kCW_Direction;
525 } 525 }
526 return result; 526 return result;
527 } 527 }
528 528
529 SkPath::PathAsRect SkPath::asRect(Direction* direction) const {
530 SK_COMPILE_ASSERT(0 == kNone_PathAsRect, path_as_rect_mismatch);
531 SK_COMPILE_ASSERT(1 == kFill_PathAsRect, path_as_rect_mismatch);
532 SK_COMPILE_ASSERT(2 == kStroke_PathAsRect, path_as_rect_mismatch);
533 bool isClosed = false;
534 return (PathAsRect) (this->isRect(NULL, &isClosed, direction) + isClosed);
535 }
536
537 bool SkPath::isRect(SkRect* rect, bool* isClosed, Direction* direction) const { 529 bool SkPath::isRect(SkRect* rect, bool* isClosed, Direction* direction) const {
538 SkDEBUGCODE(this->validate();) 530 SkDEBUGCODE(this->validate();)
539 int currVerb = 0; 531 int currVerb = 0;
540 const SkPoint* pts = fPathRef->points(); 532 const SkPoint* pts = fPathRef->points();
541 const SkPoint* first = pts; 533 const SkPoint* first = pts;
542 if (!this->isRectContour(false, &currVerb, &pts, isClosed, direction)) { 534 if (!this->isRectContour(false, &currVerb, &pts, isClosed, direction)) {
543 return false; 535 return false;
544 } 536 }
545 if (rect) { 537 if (rect) {
546 int32_t num = SkToS32(pts - first); 538 int32_t num = SkToS32(pts - first);
(...skipping 2393 matching lines...) Expand 10 before | Expand all | Expand 10 after
2940 switch (this->getFillType()) { 2932 switch (this->getFillType()) {
2941 case SkPath::kEvenOdd_FillType: 2933 case SkPath::kEvenOdd_FillType:
2942 case SkPath::kInverseEvenOdd_FillType: 2934 case SkPath::kInverseEvenOdd_FillType:
2943 w &= 1; 2935 w &= 1;
2944 break; 2936 break;
2945 default: 2937 default:
2946 break; 2938 break;
2947 } 2939 }
2948 return SkToBool(w); 2940 return SkToBool(w);
2949 } 2941 }
OLDNEW
« no previous file with comments | « src/core/SkClipStack.cpp ('k') | tests/PathTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698