aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core/SkPaint.h
diff options
context:
space:
mode:
authorGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-04-01 18:31:44 +0000
committerGravatar reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2009-04-01 18:31:44 +0000
commitd252db03d9650013b545ef9781fe993c07f8f314 (patch)
tree85afe2a17d58115d5e62225487e27308c7ad5f82 /include/core/SkPaint.h
parent6c924ad46c89955e78e071c792ef00df9910b42f (diff)
API change: SkPath computeBounds -> getBounds
git-svn-id: http://skia.googlecode.com/svn/trunk@140 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkPaint.h')
-rw-r--r--include/core/SkPaint.h20
1 files changed, 16 insertions, 4 deletions
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h
index fc390ab819..fd35292be3 100644
--- a/include/core/SkPaint.h
+++ b/include/core/SkPaint.h
@@ -371,8 +371,14 @@ public:
bounds (i.e. there is nothing complex like a patheffect that would make
the bounds computation expensive.
*/
- bool canComputeFastBounds() const;
-
+ bool canComputeFastBounds() const {
+ // use bit-or since no need for early exit
+ return (reinterpret_cast<uintptr_t>(this->getMaskFilter()) |
+ reinterpret_cast<uintptr_t>(this->getLooper()) |
+ reinterpret_cast<uintptr_t>(this->getRasterizer()) |
+ reinterpret_cast<uintptr_t>(this->getPathEffect())) == 0;
+ }
+
/** Only call this if canComputeFastBounds() returned true. This takes a
raw rectangle (the raw bounds of a shape), and adjusts it for stylistic
effects in the paint (e.g. stroking). If needed, it uses the storage
@@ -394,7 +400,10 @@ public:
}
}
*/
- const SkRect& computeFastBounds(const SkRect& orig, SkRect* storage) const;
+ const SkRect& computeFastBounds(const SkRect& orig, SkRect* storage) const {
+ return this->getStyle() == kFill_Style ? orig :
+ this->computeStrokeFastBounds(orig, storage);
+ }
/** Get the paint's shader object.
<p />
@@ -759,7 +768,10 @@ private:
void descriptorProc(const SkMatrix* deviceMatrix,
void (*proc)(const SkDescriptor*, void*),
void* context) const;
-
+
+ const SkRect& computeStrokeFastBounds(const SkRect& orig,
+ SkRect* storage) const;
+
enum {
kCanonicalTextSizeForPaths = 64
};