Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(989)

Unified Diff: src/record/SkRecordDraw.cpp

Issue 260143002: Simplify empty-clip check. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: prune Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/record/SkRecordDraw.cpp
diff --git a/src/record/SkRecordDraw.cpp b/src/record/SkRecordDraw.cpp
index 74549db66f50ecbfbab1c0af41cf65db1d59aadd..bc1bbf5fd44f19f72d29bab41187c0c93ec1b8da 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 @@ public:
template <typename T> void operator()(const T& r) {
if (!this->skip(r)) {
this->draw(r);
- this->updateClip<T>();
}
}
@@ -41,7 +34,7 @@ private:
// 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 @@ private:
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.
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698