aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkClipStackDevice.cpp
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@google.com>2017-03-03 20:27:13 +0000
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2017-03-03 20:27:22 +0000
commitbaf06bc89a0ee2ac4033281e7310f6c727faab79 (patch)
tree13aca9c2e88a457a91f2d0dcf0f3418411ea63fc /src/core/SkClipStackDevice.cpp
parent94fc0fe016bbfeb097c829df513673d4fcbb38b3 (diff)
Revert "Revert[2] "Remove SkDraw from device-draw methods, and enable device-centric clipping."""
This reverts commit cfaa63237b152ae216f1351207bce3ea9808814c. Reason for revert: speculative revert to fix Google3 Original change's description: > Revert[2] "Remove SkDraw from device-draw methods, and enable device-centric clipping."" > > passes new (augmented) CanvasClipType unittest > fixed rasterclipstack::setnewsize > > This reverts commit ea5e676a7b75600edcde3912886486004ccd7626. > > BUG=skia: > > Change-Id: I004653e0f4d01454662f8516fccab0046486f273 > Reviewed-on: https://skia-review.googlesource.com/9185 > Reviewed-by: Brian Salomon <bsalomon@google.com> > Commit-Queue: Mike Reed <reed@google.com> > TBR=bsalomon@google.com,reed@google.com,reviews@skia.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Change-Id: Ibd7ee6383999f008eb6ee59c1c3f1c06a86044ea Reviewed-on: https://skia-review.googlesource.com/9230 Reviewed-by: Cary Clark <caryclark@google.com> Commit-Queue: Cary Clark <caryclark@google.com>
Diffstat (limited to 'src/core/SkClipStackDevice.cpp')
-rw-r--r--src/core/SkClipStackDevice.cpp62
1 files changed, 9 insertions, 53 deletions
diff --git a/src/core/SkClipStackDevice.cpp b/src/core/SkClipStackDevice.cpp
index dd5118d319..799850b839 100644
--- a/src/core/SkClipStackDevice.cpp
+++ b/src/core/SkClipStackDevice.cpp
@@ -9,16 +9,6 @@
#include "SkDraw.h"
#include "SkRasterClip.h"
-SkIRect SkClipStackDevice::devClipBounds() const {
- SkIRect r = fClipStack.bounds(this->imageInfo().bounds()).roundOut();
- if (!r.isEmpty()) {
- SkASSERT(this->imageInfo().bounds().contains(r));
- }
- return r;
-}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
void SkClipStackDevice::onSave() {
fClipStack.save();
}
@@ -62,47 +52,13 @@ void SkClipStackDevice::onSetDeviceClipRestriction(SkIRect* clipRestriction) {
}
}
-bool SkClipStackDevice::onClipIsAA() const {
- SkClipStack::B2TIter iter(fClipStack);
- const SkClipStack::Element* element;
-
- while ((element = iter.next()) != nullptr) {
- if (element->isAA()) {
- return true;
- }
- }
- return false;
-}
-
-void SkClipStackDevice::onAsRgnClip(SkRegion* rgn) const {
- SkClipStack::BoundsType boundType;
- bool isIntersectionOfRects;
- SkRect bounds;
- fClipStack.getBounds(&bounds, &boundType, &isIntersectionOfRects);
- if (isIntersectionOfRects && SkClipStack::kNormal_BoundsType == boundType) {
- rgn->setRect(bounds.round());
- } else {
- SkPath path;
- fClipStack.asPath(&path);
- rgn->setPath(path, SkRegion(SkIRect::MakeWH(this->width(), this->height())));
- }
-}
-
-SkBaseDevice::ClipType SkClipStackDevice::onGetClipType() const {
- if (fClipStack.isWideOpen()) {
- return kRect_ClipType;
- }
- if (fClipStack.isEmpty(SkIRect::MakeWH(this->width(), this->height()))) {
- return kEmpty_ClipType;
- } else {
- SkClipStack::BoundsType boundType;
- bool isIntersectionOfRects;
- SkRect bounds;
- fClipStack.getBounds(&bounds, &boundType, &isIntersectionOfRects);
- if (isIntersectionOfRects && SkClipStack::kNormal_BoundsType == boundType) {
- return kRect_ClipType;
- } else {
- return kComplex_ClipType;
- }
- }
+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
}