add isClipEmpty() -- encourage clients to call this rather than checking clipFoo() results

BUG=skia:
R=robertphillips@google.com

Review URL: https://codereview.chromium.org/177073006

git-svn-id: http://skia.googlecode.com/svn/trunk@13568 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2014-02-24 19:38:20 +00:00
parent 5cc25359c6
commit 754de5f65b
2 changed files with 13 additions and 0 deletions

View File

@ -972,6 +972,15 @@ public:
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
/**
* Return true if the current clip is empty (i.e. nothing will draw).
* Note: this is not always a free call, so it should not be used
* more often than necessary. However, once the canvas has computed this
* result, subsequent calls will be cheap (until the clip state changes,
* which can happen on any clip..() or restore() call.
*/
bool isClipEmpty() const;
/** Return the current matrix on the canvas. /** Return the current matrix on the canvas.
This does not account for the translate in any of the devices. This does not account for the translate in any of the devices.
@return The current matrix on the canvas. @return The current matrix on the canvas.

View File

@ -1484,6 +1484,10 @@ void SkCanvas::replayClips(ClipVisitor* visitor) const {
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
bool SkCanvas::isClipEmpty() const {
return fMCRec->fRasterClip->isEmpty();
}
bool SkCanvas::quickReject(const SkRect& rect) const { bool SkCanvas::quickReject(const SkRect& rect) const {
if (!rect.isFinite()) if (!rect.isFinite())