use common intermediate device class for clipstack management

BUG=skia:6214

Change-Id: I64b849ad7c8dafe423e24e6fccfb3f0c1d096ab0
Reviewed-on: https://skia-review.googlesource.com/8669
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Florin Malita <fmalita@chromium.org>
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index 791d435..6ab2d60 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -238,7 +238,7 @@
 
 #ifdef SK_USE_DEVICE_CLIPPING
     SkASSERT(*draw.fMatrix == this->ctm());
-    fClip.reset(&fClipStack, nullptr);
+    fClip.reset(&this->cs(), nullptr);
 #else
     fClip.reset(draw.fClipStack, &this->getOrigin());
 #endif
@@ -1825,54 +1825,4 @@
     return SkImageFilterCache::Create(SkImageFilterCache::kDefaultTransientSize);
 }
 
-///////////////////////////////////////////////////////////////////////////////////////////////////
-
-void SkGpuDevice::onSave() {
-    fClipStack.save();
-}
-
-void SkGpuDevice::onRestore() {
-    fClipStack.restore();
-}
-
-void SkGpuDevice::onClipRect(const SkRect& rect, SkClipOp op, bool aa) {
-    fClipStack.clipRect(rect, this->ctm(), op, aa);
-}
-
-void SkGpuDevice::onClipRRect(const SkRRect& rrect, SkClipOp op, bool aa) {
-    fClipStack.clipRRect(rrect, this->ctm(), op, aa);
-}
-
-void SkGpuDevice::onClipPath(const SkPath& path, SkClipOp op, bool aa) {
-    fClipStack.clipPath(path, this->ctm(), op, aa);
-}
-
-void SkGpuDevice::onClipRegion(const SkRegion& rgn, SkClipOp op) {
-    SkIPoint origin = this->getOrigin();
-    SkRegion tmp;
-    const SkRegion* ptr = &rgn;
-    if (origin.fX | origin.fY) {
-        // translate from "global/canvas" coordinates to relative to this device
-        rgn.translate(-origin.fX, -origin.fY, &tmp);
-        ptr = &tmp;
-    }
-    fClipStack.clipDevRect(ptr->getBounds(), op);
-}
-
-void SkGpuDevice::onSetDeviceClipRestriction(SkIRect* clipRestriction) {
-    if (clipRestriction->isEmpty()) {
-        fClipStack.setDeviceClipRestriction(*clipRestriction);
-    } else {
-        SkIPoint origin = this->getOrigin();
-        SkIRect rect = clipRestriction->makeOffset(-origin.x(), -origin.y());
-        fClipStack.setDeviceClipRestriction(rect);
-        fClipStack.clipDevRect(rect, SkClipOp::kIntersect);
-    }
-}
-
-void SkGpuDevice::validateDevBounds(const SkIRect& drawClipBounds) {
-#ifdef SK_DEBUG
-#endif
-}
-
 #endif