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: include/core/SkPath.h

Issue 140953003: add alternative to isRect named asRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 | « no previous file | src/core/SkPath.cpp » ('j') | src/core/SkPath.cpp » ('J')
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 #ifndef SkPath_DEFINED 10 #ifndef SkPath_DEFINED
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 * cheapComputDirection() and if that computed direction matches the 548 * cheapComputDirection() and if that computed direction matches the
549 * specified direction. If dir is kUnknown, returns true if the direction 549 * specified direction. If dir is kUnknown, returns true if the direction
550 * cannot be computed. 550 * cannot be computed.
551 */ 551 */
552 bool cheapIsDirection(Direction dir) const { 552 bool cheapIsDirection(Direction dir) const {
553 Direction computedDir = kUnknown_Direction; 553 Direction computedDir = kUnknown_Direction;
554 (void)this->cheapComputeDirection(&computedDir); 554 (void)this->cheapComputeDirection(&computedDir);
555 return computedDir == dir; 555 return computedDir == dir;
556 } 556 }
557 557
558 enum PathAsRect {
559 /** The path can not draw the same as its bounds. */
560 kNone_PathAsRect,
561 /** The path draws the same as its bounds when stroked or filled. */
562 kStroke_PathAsRect,
563 /** The path draws the same as its bounds when filled. */
564 kFill_PathAsRect,
565 };
566
567 /** Returns kFill_PathAsRect or kStroke_PathAsRect if the path is a rect. If
reed1 2014/01/23 18:34:20 I wonder if we want a different overall descriptio
caryclark 2014/01/23 19:03:23 Done.
568 so, and direction is not null, sets the direction of the contour. If the
569 path is not a rect, returns kNone_PathAsRect and ignores direction.
570
571 @param direction If not null, set to the contour's direction when it is a rect
572 @return the path's PathAsRect type
573 */
574 PathAsRect asRect(Direction* direction = NULL) const;
575
558 /** Returns true if the path specifies a rectangle. If so, and if isClosed i s 576 /** Returns true if the path specifies a rectangle. If so, and if isClosed i s
559 not null, set isClosed to true if the path is closed. Also, if returning true 577 not null, set isClosed to true if the path is closed. Also, if returning true
560 and direction is not null, return the rect direction. If the path does n ot 578 and direction is not null, return the rect direction. If the path does n ot
561 specify a rectangle, return false and ignore isClosed and direction. 579 specify a rectangle, return false and ignore isClosed and direction.
562 580
563 @param isClosed If not null, set to true if the path is closed 581 @param isClosed If not null, set to true if the path is closed
564 @param direction If not null, set to the rectangle's direction 582 @param direction If not null, set to the rectangle's direction
565 @return true if the path specifies a rectangle 583 @return true if the path specifies a rectangle
566 */ 584 */
567 bool isRect(bool* isClosed, Direction* direction) const; 585 bool isRect(bool* isClosed, Direction* direction) const;
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 friend class SkPathRef; // just for SerializationOffsets 1032 friend class SkPathRef; // just for SerializationOffsets
1015 #endif 1033 #endif
1016 friend class SkAutoPathBoundsUpdate; 1034 friend class SkAutoPathBoundsUpdate;
1017 friend class SkAutoDisableOvalCheck; 1035 friend class SkAutoDisableOvalCheck;
1018 friend class SkAutoDisableDirectionCheck; 1036 friend class SkAutoDisableDirectionCheck;
1019 friend class SkBench_AddPathTest; // perf test reversePathTo 1037 friend class SkBench_AddPathTest; // perf test reversePathTo
1020 friend class PathTest_Private; // unit test reversePathTo 1038 friend class PathTest_Private; // unit test reversePathTo
1021 }; 1039 };
1022 1040
1023 #endif 1041 #endif
OLDNEW
« no previous file with comments | « no previous file | src/core/SkPath.cpp » ('j') | src/core/SkPath.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698