aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPath.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/SkPath.cpp')
-rw-r--r--src/core/SkPath.cpp17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index fe9551492d..ae1d187d0d 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -11,9 +11,9 @@
#include "SkBuffer.h"
#include "SkMath.h"
#include "SkPathRef.h"
+#include "SkRRect.h"
#include "SkThread.h"
-
////////////////////////////////////////////////////////////////////////////
#if SK_DEBUG_PATH_REF
@@ -1088,6 +1088,21 @@ void SkPath::addRoundRect(const SkRect& rect, const SkScalar rad[],
this->close();
}
+void SkPath::addRRect(const SkRRect& rrect, Direction dir) {
+ const SkRect& bounds = rrect.getBounds();
+
+ if (rrect.isRect()) {
+ this->addRect(bounds, dir);
+ } else if (rrect.isOval()) {
+ this->addOval(bounds, dir);
+ } else if (rrect.isSimple()) {
+ const SkVector& rad = rrect.getSimpleRadii();
+ this->addRoundRect(bounds, rad.x(), rad.y(), dir);
+ } else {
+ this->addRoundRect(bounds, (const SkScalar*)&rrect.fRadii[0], dir);
+ }
+}
+
bool SkPath::hasOnlyMoveTos() const {
int count = fPathRef->countVerbs();
const uint8_t* verbs = const_cast<const SkPathRef*>(fPathRef.get())->verbsMemBegin();