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

Unified Diff: src/record/SkRecordDraw.cpp

Issue 258183002: Don't bother doing the empty clip check in SkRecordDraw. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comments and tests 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 | tests/RecordDrawTest.cpp » ('j') | 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 bc1bbf5fd44f19f72d29bab41187c0c93ec1b8da..4878b3f4f654dd475a8c51a0750e8f45403f3100 100644
--- a/src/record/SkRecordDraw.cpp
+++ b/src/record/SkRecordDraw.cpp
@@ -7,8 +7,6 @@
#include "SkRecordDraw.h"
-#include "SkRecordTraits.h"
-
namespace {
// This is an SkRecord visitor that will draw that SkRecord to an SkCanvas.
@@ -29,27 +27,22 @@ private:
// No base case, so we'll be compile-time checked that we implemented all possibilities below.
template <typename T> void draw(const T&);
- // skip() returns true if we can skip this command, false if not.
- // Update fIndex directly to skip more than just this one command.
-
- // 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 fCanvas->isClipEmpty(); }
+ // skip() should return true if we can skip this command, false if not.
+ // It may update fIndex directly to skip more than just this one command.
- template <typename T>
- SK_WHEN(!SkRecords::IsDraw<T>, bool) skip(const T&) { return false; }
+ // Mostly we just blindly call fCanvas and let it handle quick rejects itself.
+ template <typename T> bool skip(const T&) { return false; }
- // Special versions for commands added by optimizations.
+ // We add our own quick rejects for commands added by optimizations.
bool skip(const SkRecords::PairedPushCull& r) {
if (fCanvas->quickReject(r.base->rect)) {
fIndex += r.skip;
return true;
}
- return this->skip(*r.base);
+ return false;
}
-
bool skip(const SkRecords::BoundedDrawPosTextH& r) {
- return this->skip(*r.base) || fCanvas->quickRejectY(r.minY, r.maxY);
+ return fCanvas->quickRejectY(r.minY, r.maxY);
}
SkCanvas* fCanvas;
« no previous file with comments | « no previous file | tests/RecordDrawTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698