aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkCanvas.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/SkCanvas.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/SkCanvas.cpp')
-rw-r--r--src/core/SkCanvas.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 6a825b5402..cb76051add 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -668,6 +668,7 @@ SkBaseDevice* SkCanvas::init(SkBaseDevice* device, InitFlags flags) {
fMCRec = (MCRec*)fMCStack.push_back();
new (fMCRec) MCRec(fConservativeRasterClip);
+ fMCRec->fRasterClip.setDeviceClipRestriction(&fClipRestrictionRect);
fIsScaleTranslate = true;
SkASSERT(sizeof(DeviceCM) <= sizeof(fDeviceCMStorage));
@@ -1539,6 +1540,19 @@ void SkCanvas::onClipRect(const SkRect& rect, SkClipOp op, ClipEdgeStyle edgeSty
fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds());
}
+void SkCanvas::androidFramework_setDeviceClipRestriction(const SkIRect& rect) {
+ fClipRestrictionRect = rect;
+ fClipStack->setDeviceClipRestriction(fClipRestrictionRect);
+ if (!fClipRestrictionRect.isEmpty()) {
+ this->checkForDeferredSave();
+ AutoValidateClip avc(this);
+ fClipStack->clipDevRect(fClipRestrictionRect, kIntersect_SkClipOp);
+ fMCRec->fRasterClip.op(fClipRestrictionRect, SkRegion::kIntersect_Op);
+ fDeviceCMDirty = true;
+ fDeviceClipBounds = qr_clip_bounds(fMCRec->fRasterClip.getBounds());
+ }
+}
+
void SkCanvas::clipRRect(const SkRRect& rrect, SkClipOp op, bool doAA) {
this->checkForDeferredSave();
ClipEdgeStyle edgeStyle = doAA ? kSoft_ClipEdgeStyle : kHard_ClipEdgeStyle;