diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-16 18:27:05 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-08-16 18:27:05 +0000 |
commit | da17f758442f16747af39f8fbaed9c097048519c (patch) | |
tree | 5f14781735ee6087913fc5d18f5120a275efa226 | |
parent | 460a23e6fd6b71c80d5515300c6b989cd3383029 (diff) |
add SK_ENABLE_CLIP_QUICKREJECT option (currently disabled)
git-svn-id: http://skia.googlecode.com/svn/trunk@5135 2bbb7eff-a529-9590-31e7-b0007b416f81
-rw-r--r-- | src/core/SkCanvas.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp index 57f11df9f2..4e4d430f21 100644 --- a/src/core/SkCanvas.cpp +++ b/src/core/SkCanvas.cpp @@ -25,6 +25,8 @@ SK_DEFINE_INST_COUNT(SkBounder) SK_DEFINE_INST_COUNT(SkCanvas) SK_DEFINE_INST_COUNT(SkDrawFilter) +// experimental for faster tiled drawing... +//#define SK_ENABLE_CLIP_QUICKREJECT //#define SK_TRACE_SAVERESTORE @@ -1095,6 +1097,23 @@ void SkCanvas::resetMatrix() { ////////////////////////////////////////////////////////////////////////////// bool SkCanvas::clipRect(const SkRect& rect, SkRegion::Op op, bool doAA) { +#ifdef SK_ENABLE_CLIP_QUICKREJECT + if (SkRegion::kIntersect_Op == op) { + if (fMCRec->fRasterClip->isEmpty()) { + return false; + } + + if (this->quickReject(rect, kAA_EdgeType)) { + fDeviceCMDirty = true; + fLocalBoundsCompareTypeDirty = true; + fLocalBoundsCompareTypeDirtyBW = true; + + fClipStack.clipEmpty(); + return fMCRec->fRasterClip->setEmpty(); + } + } +#endif + AutoValidateClip avc(this); fDeviceCMDirty = true; @@ -1160,6 +1179,23 @@ static bool clipPathHelper(const SkCanvas* canvas, SkRasterClip* currClip, } bool SkCanvas::clipPath(const SkPath& path, SkRegion::Op op, bool doAA) { +#ifdef SK_ENABLE_CLIP_QUICKREJECT + if (SkRegion::kIntersect_Op == op && !path.isInverseFillType()) { + if (fMCRec->fRasterClip->isEmpty()) { + return false; + } + + if (this->quickReject(path.getBounds(), kAA_EdgeType)) { + fDeviceCMDirty = true; + fLocalBoundsCompareTypeDirty = true; + fLocalBoundsCompareTypeDirtyBW = true; + + fClipStack.clipEmpty(); + return fMCRec->fRasterClip->setEmpty(); + } + } +#endif + AutoValidateClip avc(this); fDeviceCMDirty = true; |