diff options
author | djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-02-27 16:17:59 +0000 |
---|---|---|
committer | djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-02-27 16:17:59 +0000 |
commit | 92d2a299d2738e4369508ea1296981a2f1f8aadb (patch) | |
tree | 2b900f0c017f279e3d30e7406811e5d9bf78d4cc /include/core/SkCanvas.h | |
parent | c16ca92fd1ca609eb2902d14727bec78848ba767 (diff) |
reapply r3259 (that was reverted) with fix.
The SkASSERT was incorrect and failing on debug runs.
Review URL: https://codereview.appspot.com/5699071
git-svn-id: http://skia.googlecode.com/svn/trunk@3263 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include/core/SkCanvas.h')
-rw-r--r-- | include/core/SkCanvas.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 84d10386fa..1b9f0558ba 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -429,7 +429,16 @@ public: @return true if the horizontal band is completely clipped out (i.e. does not intersect the current clip) */ - bool quickRejectY(SkScalar top, SkScalar bottom, EdgeType et) const; + bool quickRejectY(SkScalar top, SkScalar bottom, EdgeType et) const { + SkASSERT(SkScalarToCompareType(top) <= SkScalarToCompareType(bottom)); + const SkRectCompareType& clipR = this->getLocalClipBoundsCompareType(et); + // In the case where the clip is empty and we are provided with a + // negative top and positive bottom parameter then this test will return + // false even though it will be clipped. We have chosen to exclude that + // check as it is rare and would result double the comparisons. + return SkScalarToCompareType(top) >= clipR.fBottom + || SkScalarToCompareType(bottom) <= clipR.fTop; + } /** Return the bounds of the current clip (in local coordinates) in the bounds parameter, and return true if it is non-empty. This can be useful |