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

Unified Diff: src/gpu/GrShape.h

Issue 1971613004: Add isEmpty() query to GrShape and improve comments. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/GrShapeTest.cpp » ('j') | tests/GrShapeTest.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrShape.h
diff --git a/src/gpu/GrShape.h b/src/gpu/GrShape.h
index d72b17965ce4f4eb21e16237263307b19477b13f..81684e8e2f5cf0c9e3eebff2be3d42be8e0d79c9 100644
--- a/src/gpu/GrShape.h
+++ b/src/gpu/GrShape.h
@@ -115,6 +115,7 @@ public:
return GrShape(*this, apply, scale);
}
+ /** Returns the unstyled geometry as a rrect if possible. */
bool asRRect(SkRRect* rrect) const {
if (Type::kRRect != fType) {
return false;
@@ -125,6 +126,7 @@ public:
return true;
}
+ /** Returns the unstyled geometry as a path. */
void asPath(SkPath* out) const {
switch (fType) {
case Type::kEmpty:
@@ -141,8 +143,14 @@ public:
}
/**
- * Is it known that the shape has no unclosed contours. This means that it will not have
- * any caps if stroked (modulo the effect of any path effect).
+ * Returns whether the geometry is empty. Note that applying the style could produce a
+ * non-empty shape.
+ */
+ bool isEmpty() const { return Type::kEmpty == fType; }
+
+ /**
+ * Is it known that the unstyled geometry has no unclosed contours. This means that it will
+ * not have any caps if stroked (modulo the effect of any path effect).
*/
bool knownToBeClosed() const {
switch (fType) {
« no previous file with comments | « no previous file | tests/GrShapeTest.cpp » ('j') | tests/GrShapeTest.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698