aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/SkPath.cpp21
-rw-r--r--src/core/SkStroke.cpp5
2 files changed, 12 insertions, 14 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index e997b80e4f..2d819c168d 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -584,22 +584,19 @@ bool SkPath::isRectContour(bool allowPartial, int* currVerb, const SkPoint** pts
return result;
}
-bool SkPath::isRect(SkRect* rect) const {
+bool SkPath::isRect(SkRect* rect, bool* isClosed, Direction* direction) const {
SkDEBUGCODE(this->validate();)
int currVerb = 0;
const SkPoint* pts = fPathRef->points();
- bool result = isRectContour(false, &currVerb, &pts, NULL, NULL);
- if (result && rect) {
- *rect = getBounds();
+ const SkPoint* first = pts;
+ if (!this->isRectContour(false, &currVerb, &pts, isClosed, direction)) {
+ return false;
}
- return result;
-}
-
-bool SkPath::isRect(bool* isClosed, Direction* direction) const {
- SkDEBUGCODE(this->validate();)
- int currVerb = 0;
- const SkPoint* pts = fPathRef->points();
- return isRectContour(false, &currVerb, &pts, isClosed, direction);
+
+ if (rect) {
+ rect->set(first, SkToS32(pts - first));
+ }
+ return true;
}
bool SkPath::isNestedRects(SkRect rects[2], Direction dirs[2]) const {
diff --git a/src/core/SkStroke.cpp b/src/core/SkStroke.cpp
index d094ef65b7..2fd5a14c2c 100644
--- a/src/core/SkStroke.cpp
+++ b/src/core/SkStroke.cpp
@@ -549,10 +549,11 @@ void SkStroke::strokePath(const SkPath& src, SkPath* dst) const {
// If src is really a rect, call our specialty strokeRect() method
{
+ SkRect rect;
bool isClosed;
SkPath::Direction dir;
- if (src.isRect(&isClosed, &dir) && isClosed) {
- this->strokeRect(src.getBounds(), dst, dir);
+ if (src.isRect(&rect, &isClosed, &dir) && isClosed) {
+ this->strokeRect(rect, dst, dir);
// our answer should preserve the inverseness of the src
if (src.isInverseFillType()) {
SkASSERT(!dst->isInverseFillType());