aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkClipStackDevice.cpp
diff options
context:
space:
mode:
authorGravatar Mike Reed <reed@google.com>2017-02-22 15:21:35 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-02-23 01:16:23 +0000
commitfa24d344882b8009a1fe25cf110c0e75e552a6ff (patch)
treed236f57e0e5e92ecfa569c6a12cf29752c6590ef /src/core/SkClipStackDevice.cpp
parent9cd21683cae5c575be102f072d2718bab37eac9c (diff)
abstract access to device-clip-bounds
apply this to GpuDevice. Should allow us to switch to per-device-clipping with minimal change (since we've abstracted how the device sees its clip-bounds.) BUG=skia: Change-Id: I5245d90f308c21abdb58d441c326670b65e9179d Reviewed-on: https://skia-review.googlesource.com/8884 Reviewed-by: Mike Reed <reed@google.com> Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/core/SkClipStackDevice.cpp')
-rw-r--r--src/core/SkClipStackDevice.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/core/SkClipStackDevice.cpp b/src/core/SkClipStackDevice.cpp
index e1014e98b6..799850b839 100644
--- a/src/core/SkClipStackDevice.cpp
+++ b/src/core/SkClipStackDevice.cpp
@@ -6,6 +6,8 @@
*/
#include "SkClipStackDevice.h"
+#include "SkDraw.h"
+#include "SkRasterClip.h"
void SkClipStackDevice::onSave() {
fClipStack.save();
@@ -49,3 +51,14 @@ void SkClipStackDevice::onSetDeviceClipRestriction(SkIRect* clipRestriction) {
fClipStack.clipDevRect(rect, SkClipOp::kIntersect);
}
}
+
+SkIRect SkClipStackDevice::devClipBounds(const SkDraw& draw) const {
+#ifdef SK_USE_DEVICE_CLIPPING
+ SkIRect r = fClipStack.bounds(this->imageInfo().bounds()).roundOut();
+ SkASSERT(this->imageInfo().bounds().contains(r));
+ SkASSERT(draw.fRC->getBounds().contains(r));
+ return r;
+#else
+ return draw.fRC->getBounds();
+#endif
+}