aboutsummaryrefslogtreecommitdiffhomepage
path: root/experimental/sksg/geometry/SkSGRect.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'experimental/sksg/geometry/SkSGRect.cpp')
-rw-r--r--experimental/sksg/geometry/SkSGRect.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/experimental/sksg/geometry/SkSGRect.cpp b/experimental/sksg/geometry/SkSGRect.cpp
index a49fcf1315..c2ac384bef 100644
--- a/experimental/sksg/geometry/SkSGRect.cpp
+++ b/experimental/sksg/geometry/SkSGRect.cpp
@@ -9,6 +9,7 @@
#include "SkCanvas.h"
#include "SkPaint.h"
+#include "SkPath.h"
namespace sksg {
@@ -24,6 +25,12 @@ SkRect Rect::onRevalidate(InvalidationController*, const SkMatrix&) {
return fRect;
}
+SkPath Rect::onAsPath() const {
+ SkPath path;
+ path.addRect(fRect);
+ return path;
+}
+
RRect::RRect(const SkRRect& rr) : fRRect(rr) {}
void RRect::onDraw(SkCanvas* canvas, const SkPaint& paint) const {
@@ -36,4 +43,10 @@ SkRect RRect::onRevalidate(InvalidationController*, const SkMatrix&) {
return fRRect.getBounds();
}
+SkPath RRect::onAsPath() const {
+ SkPath path;
+ path.addRRect(fRRect);
+ return path;
+}
+
} // namespace sksg