aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkClipStack.cpp
diff options
context:
space:
mode:
authorGravatar Stan Iliev <stani@google.com>2016-12-12 17:39:55 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2016-12-12 23:24:31 +0000
commit5f1bb0a7c5186e797aa0f0d447a68fc3fbf3c2fe (patch)
tree935c5f0922e389c84644d19fdb0fe6110cc334fc /src/core/SkClipStack.cpp
parent966bb348a5bdeec44252ede4cb73ba907af2d92b (diff)
Add a method in SkCanvas to set "hard" clip bounds.
Add SkCanvas::setBoundRect, which sets the max clip rectangle, which can be replaced by clipRect, clipRRect and clipPath. BUG=skia: Change-Id: Ie39eb1715214971576e7a1dda760c6997a7e0208 Reviewed-on: https://skia-review.googlesource.com/5359 Commit-Queue: Stan Iliev <stani@google.com> Reviewed-by: Mike Reed <reed@google.com> Reviewed-by: Derek Sollenberger <djsollen@google.com>
Diffstat (limited to 'src/core/SkClipStack.cpp')
-rw-r--r--src/core/SkClipStack.cpp14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp
index c7d5359760..bc8c5c5d62 100644
--- a/src/core/SkClipStack.cpp
+++ b/src/core/SkClipStack.cpp
@@ -734,6 +734,10 @@ void SkClipStack::clipRRect(const SkRRect& rrect, const SkMatrix& matrix, SkClip
if (rrect.transform(matrix, &transformedRRect)) {
Element element(fSaveCount, transformedRRect, op, doAA);
this->pushElement(element);
+ if (this->hasClipRestriction(op)) {
+ Element element(fSaveCount, fClipRestrictionRect, kIntersect_SkClipOp, false);
+ this->pushElement(element);
+ }
return;
}
SkPath path;
@@ -747,6 +751,11 @@ void SkClipStack::clipRect(const SkRect& rect, const SkMatrix& matrix, SkClipOp
if (matrix.rectStaysRect()) {
SkRect devRect;
matrix.mapRect(&devRect, rect);
+ if (this->hasClipRestriction(op)) {
+ if (!devRect.intersect(fClipRestrictionRect)) {
+ devRect.setEmpty();
+ }
+ }
Element element(fSaveCount, devRect, op, doAA);
this->pushElement(element);
return;
@@ -761,9 +770,12 @@ void SkClipStack::clipPath(const SkPath& path, const SkMatrix& matrix, SkClipOp
bool doAA) {
SkPath devPath;
path.transform(matrix, &devPath);
-
Element element(fSaveCount, devPath, op, doAA);
this->pushElement(element);
+ if (this->hasClipRestriction(op)) {
+ Element element(fSaveCount, fClipRestrictionRect, kIntersect_SkClipOp, false);
+ this->pushElement(element);
+ }
}
void SkClipStack::clipEmpty() {