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

Unified Diff: include/core/SkPath.h

Issue 1461763004: add SkPath::isRRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove erroneous qualification Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/core/SkPathRef.h » ('j') | include/core/SkPathRef.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPath.h
diff --git a/include/core/SkPath.h b/include/core/SkPath.h
index 3ff0af15a21d37d9b12383f1ed9d4640f551d0b7..09edc2e7edfda79ef58cdd5ceee3fa9a699c780d 100644
--- a/include/core/SkPath.h
+++ b/include/core/SkPath.h
@@ -154,6 +154,17 @@ public:
*/
bool isOval(SkRect* rect) const { return fPathRef->isOval(rect); }
+ /** Returns true if the path is a round rect.
+ *
+ * @param rrect Returns the bounding rect and radii of this round rect.
+ *
+ * @return true if this path is a round rect.
+ * Tracking whether a path is a round rect is considered an
+ * optimization for performance and so some paths that are in
+ * fact round rects can report false.
+ */
+ bool isRRect(SkRRect* rrect) const { return fPathRef->isRRect(rrect); }
+
/** Clear any lines and curves from the path, making it empty. This frees up
internal storage associated with those segments.
On Android, does not change fSourcePath.
@@ -916,12 +927,16 @@ public:
/** Iterate through the verbs in the path, providing the associated points.
*/
- class SK_API RawIter {
+ class SK_API RawIter : public SkPathRef::Iter {
public:
- RawIter();
- RawIter(const SkPath&);
+ RawIter() {}
+ RawIter(const SkPath& path)
robertphillips 2015/11/19 22:27:28 Is there an extra ' ' here ?
caryclark 2015/11/19 22:36:05 Done.
+ : SkPathRef::Iter(*path.fPathRef.get()) {
+ }
- void setPath(const SkPath&);
+ void setPath(const SkPath& path) {
+ fRawIter.setPath(*path.fPathRef.get());
+ }
/** Return the next verb in this iteration of the path. When all
segments have been visited, return kDone_Verb.
@@ -930,15 +945,17 @@ public:
This must not be NULL.
@return The verb for the current segment
*/
- Verb next(SkPoint pts[4]);
+ Verb next(SkPoint pts[4]) {
+ return (Verb) fRawIter.next(pts);
+ }
- SkScalar conicWeight() const { return *fConicWeights; }
+ SkScalar conicWeight() const {
+ return fRawIter.conicWeight();
+ }
private:
robertphillips 2015/11/19 22:27:28 So this is both derived from and includes an SkPat
caryclark 2015/11/19 22:36:05 Ack! Fixed typo. Thanks for the extra eyeballs.
- const SkPoint* fPts;
- const uint8_t* fVerbs;
- const uint8_t* fVerbStop;
- const SkScalar* fConicWeights;
+ SkPathRef::Iter fRawIter;
+ friend class SkPath;
};
/**
@@ -1066,6 +1083,7 @@ private:
friend class SkAutoDisableDirectionCheck;
friend class SkBench_AddPathTest; // perf test reversePathTo
friend class PathTest_Private; // unit test reversePathTo
+ friend class ForceIsRRect_Private; // unit test isRRect
};
#endif
« no previous file with comments | « no previous file | include/core/SkPathRef.h » ('j') | include/core/SkPathRef.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698