diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-05-15 20:47:50 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-05-15 20:47:50 +0000 |
commit | e4f10a70807166484e5a6303a5cd0034e5e87aba (patch) | |
tree | d866f580bb5542bf3f685c588ad579454065d946 /src | |
parent | c3be34d4dbd5a9c58689e5d36fd2eda7c823b5f7 (diff) |
add computeFastBounds to SkPathEffect, so we can attempt quickReject
Review URL: https://codereview.appspot.com/6209070
git-svn-id: http://skia.googlecode.com/svn/trunk@3964 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkPaint.cpp | 19 | ||||
-rw-r--r-- | src/core/SkPathEffect.cpp | 4 |
2 files changed, 17 insertions, 6 deletions
diff --git a/src/core/SkPaint.cpp b/src/core/SkPaint.cpp index 15fdbd196e..66fa0df1be 100644 --- a/src/core/SkPaint.cpp +++ b/src/core/SkPaint.cpp @@ -2044,16 +2044,24 @@ bool SkPaint::getFillPath(const SkPath& src, SkPath* dst) const { return width != 0; // return true if we're filled, or false if we're hairline (width == 0) } -const SkRect& SkPaint::doComputeFastBounds(const SkRect& src, +const SkRect& SkPaint::doComputeFastBounds(const SkRect& origSrc, SkRect* storage) const { SkASSERT(storage); + const SkRect* src = &origSrc; + if (this->getLooper()) { SkASSERT(this->getLooper()->canComputeFastBounds(*this)); - this->getLooper()->computeFastBounds(*this, src, storage); + this->getLooper()->computeFastBounds(*this, *src, storage); return *storage; } + SkRect tmpSrc; + if (this->getPathEffect()) { + this->getPathEffect()->computeFastBounds(&tmpSrc, origSrc); + src = &tmpSrc; + } + if (this->getStyle() != SkPaint::kFill_Style) { // since we're stroked, outset the rect by the radius (and join type) SkScalar radius = SkScalarHalf(this->getStrokeWidth()); @@ -2065,13 +2073,12 @@ const SkRect& SkPaint::doComputeFastBounds(const SkRect& src, radius = SkScalarMul(radius, scale); } } - storage->set(src.fLeft - radius, src.fTop - radius, - src.fRight + radius, src.fBottom + radius); + storage->set(src->fLeft - radius, src->fTop - radius, + src->fRight + radius, src->fBottom + radius); } else { - *storage = src; + *storage = *src; } - // check the mask filter if (this->getMaskFilter()) { this->getMaskFilter()->computeFastBounds(*storage, storage); } diff --git a/src/core/SkPathEffect.cpp b/src/core/SkPathEffect.cpp index 8731aedb84..dcce6d6b56 100644 --- a/src/core/SkPathEffect.cpp +++ b/src/core/SkPathEffect.cpp @@ -11,6 +11,10 @@ #include "SkPath.h" #include "SkBuffer.h" +void SkPathEffect::computeFastBounds(SkRect* dst, const SkRect& src) { + *dst = src; +} + /////////////////////////////////////////////////////////////////////////////// SkPairPathEffect::SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1) |