Simplify empty-clip check.

No measurable playback speed difference, but simpler code.

This makes sense: I'm seeing SkRecordDraw at ~0.25% of playback cost.  We can
pretty much do whatever we want in there for free if it helps avoid real work.

BUG=skia:2378
R=fmalita@chromium.org, mtklein@google.com, reed@google.com

Author: mtklein@chromium.org

Review URL: https://codereview.chromium.org/260143002

git-svn-id: http://skia.googlecode.com/svn/trunk@14419 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/record/SkRecordDraw.cpp b/src/record/SkRecordDraw.cpp
index 74549db..bc1bbf5 100644
--- a/src/record/SkRecordDraw.cpp
+++ b/src/record/SkRecordDraw.cpp
@@ -11,16 +11,10 @@
 
 namespace {
 
-// All clip commands, Restore, and SaveLayer may change the clip.
-template <typename T> struct ChangesClip { static const bool value = SkRecords::IsClip<T>::value; };
-template <> struct ChangesClip<SkRecords::Restore> { static const bool value = true; };
-template <> struct ChangesClip<SkRecords::SaveLayer> { static const bool value = true; };
-
-
 // This is an SkRecord visitor that will draw that SkRecord to an SkCanvas.
 class Draw : SkNoncopyable {
 public:
-    explicit Draw(SkCanvas* canvas) : fCanvas(canvas), fIndex(0), fClipEmpty(false) {}
+    explicit Draw(SkCanvas* canvas) : fCanvas(canvas), fIndex(0) {}
 
     unsigned index() const { return fIndex; }
     void next() { ++fIndex; }
@@ -28,7 +22,6 @@
     template <typename T> void operator()(const T& r) {
         if (!this->skip(r)) {
             this->draw(r);
-            this->updateClip<T>();
         }
     }
 
@@ -41,7 +34,7 @@
 
     // If we're drawing into an empty clip, we can skip it.  Otherwise, run the command.
     template <typename T>
-    SK_WHEN(SkRecords::IsDraw<T>, bool) skip(const T&) { return fClipEmpty; }
+    SK_WHEN(SkRecords::IsDraw<T>, bool) skip(const T&) { return fCanvas->isClipEmpty(); }
 
     template <typename T>
     SK_WHEN(!SkRecords::IsDraw<T>, bool) skip(const T&) { return false; }
@@ -59,15 +52,8 @@
         return this->skip(*r.base) || fCanvas->quickRejectY(r.minY, r.maxY);
     }
 
-    // If we might have changed the clip, update it, else do nothing.
-    template <typename T>
-    SK_WHEN(ChangesClip<T>, void) updateClip() { fClipEmpty = fCanvas->isClipEmpty(); }
-    template <typename T>
-    SK_WHEN(!ChangesClip<T>, void) updateClip() {}
-
     SkCanvas* fCanvas;
     unsigned fIndex;
-    bool fClipEmpty;
 };
 
 // NoOps draw nothing.