From d252db03d9650013b545ef9781fe993c07f8f314 Mon Sep 17 00:00:00 2001 From: "reed@android.com" Date: Wed, 1 Apr 2009 18:31:44 +0000 Subject: API change: SkPath computeBounds -> getBounds git-svn-id: http://skia.googlecode.com/svn/trunk@140 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkPaint.h | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'include/core/SkPaint.h') 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(this->getMaskFilter()) | + reinterpret_cast(this->getLooper()) | + reinterpret_cast(this->getRasterizer()) | + reinterpret_cast(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.

@@ -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 }; -- cgit v1.2.3