Use GrDrawTarget::AutoClipRestore to set temporary irect clips.

R=robertphillips@google.com
Review URL: https://codereview.appspot.com/6937048

git-svn-id: http://skia.googlecode.com/svn/trunk@6793 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp
index 92b8a03..9ede743 100644
--- a/src/gpu/GrDrawTarget.cpp
+++ b/src/gpu/GrDrawTarget.cpp
@@ -1218,6 +1218,15 @@
     fIndices = NULL;
 }
 
+GrDrawTarget::AutoClipRestore::AutoClipRestore(GrDrawTarget* target, const SkIRect& newClip) {
+    fTarget = target;
+    fClip = fTarget->getClip();
+    fStack.init();
+    fStack.get()->clipDevRect(newClip, SkRegion::kReplace_Op);
+    fReplacementClip.fClipStack = fStack.get();
+    target->setClip(&fReplacementClip);
+}
+
 void GrDrawTarget::Caps::print() const {
     static const char* gNY[] = {"NO", "YES"};
     GrPrintf("8 Bit Palette Support       : %s\n", gNY[fInternals.f8BitPaletteSupport]);