diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-10-11 19:39:09 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-10-11 19:39:09 +0000 |
commit | 3ab43d5c5b4d77f46dd0266618f92e5fefce2021 (patch) | |
tree | 2950bae414b8cc85a61d350f945ccc55affd52d6 /src/core | |
parent | 5dc26b97366934ba0f896cea02a3fec027d5d5c1 (diff) |
Minimize use of SkDraw's matrix in SkGpuDevice.
R=robertphillips@google.com
Review URL: https://codereview.appspot.com/6604068
git-svn-id: http://skia.googlecode.com/svn/trunk@5906 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkClipStack.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp index 3c9705dcae..6fca0fc89e 100644 --- a/src/core/SkClipStack.cpp +++ b/src/core/SkClipStack.cpp @@ -567,6 +567,25 @@ void SkClipStack::getBounds(SkRect* canvFiniteBound, } } +bool SkClipStack::intersectRectWithClip(SkRect* rect) const { + SkASSERT(NULL != rect); + + SkRect bounds; + SkClipStack::BoundsType bt; + this->getBounds(&bounds, &bt); + if (bt == SkClipStack::kInsideOut_BoundsType) { + if (bounds.contains(*rect)) { + return false; + } else { + // If rect's x values are both within bound's x range we + // could clip here. Same for y. But we don't bother to check. + return true; + } + } else { + return rect->intersect(bounds); + } +} + void SkClipStack::clipDevRect(const SkRect& rect, SkRegion::Op op, bool doAA) { int32_t genID = GetNextGenID(); |