Index: include/core/SkCanvas.h |
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h |
index c97d14f92539992ea2b478cd5d5c8fe2520a5708..d19830deab4fbbddfa56e9dd1bfce76a9b669e77 100644 |
--- a/include/core/SkCanvas.h |
+++ b/include/core/SkCanvas.h |
@@ -1605,17 +1605,24 @@ |
*/ |
bool canDrawBitmapAsSprite(SkScalar x, SkScalar y, int w, int h, const SkPaint&); |
- |
- /** |
- * Keep track of the device clip bounds and if the matrix is scale-translate. This allows |
- * us to do a fast quick reject in the common case. |
- */ |
- bool fConservativeIsScaleTranslate; |
- SkRect fDeviceClipBounds; |
- |
+ /* These maintain a cache of the clip bounds in local coordinates, |
+ (converted to 2s-compliment if floats are slow). |
+ */ |
+ mutable SkRect fCachedLocalClipBounds; |
+ mutable bool fCachedLocalClipBoundsDirty; |
bool fAllowSoftClip; |
bool fAllowSimplifyClip; |
const bool fConservativeRasterClip; |
+ |
+ const SkRect& getLocalClipBounds() const { |
+ if (fCachedLocalClipBoundsDirty) { |
+ if (!this->getClipBounds(&fCachedLocalClipBounds)) { |
+ fCachedLocalClipBounds.setEmpty(); |
+ } |
+ fCachedLocalClipBoundsDirty = false; |
+ } |
+ return fCachedLocalClipBounds; |
+ } |
class AutoValidateClip : ::SkNoncopyable { |
public: |