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

Unified Diff: dm/DMReplayTask.cpp

Issue 51243003: DM: add --rtree. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: same order Created 7 years, 2 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
Index: dm/DMReplayTask.cpp
diff --git a/dm/DMReplayTask.cpp b/dm/DMReplayTask.cpp
index a0ecf5fadf7812e282b1a8a7b745a698204fda77..177d8760cd6c66eb4cebd695477b31e51cb9736f 100644
--- a/dm/DMReplayTask.cpp
+++ b/dm/DMReplayTask.cpp
@@ -6,21 +6,35 @@
#include "SkPicture.h"
DEFINE_bool(replay, false, "If true, run picture replay tests.");
+DEFINE_bool(rtree, false, "If true, run picture replay tests with an rtree.");
namespace DM {
+static const char* kReplay = "replay";
+static const char* kRTree = "rtree";
+
+static const char* flags_name(uint32_t flags) {
+ switch (flags) {
+ case 0: return kReplay;
+ case SkPicture::kOptimizeForClippedPlayback_RecordingFlag: return kRTree;
+ default: return "hey-give-me-a-name";
epoger 2013/10/30 19:37:01 maybe SkASSERT failure in this case?
+ }
+}
+
ReplayTask::ReplayTask(const Task& parent,
skiagm::GM* gm,
- SkBitmap reference)
+ SkBitmap reference,
+ uint32_t recordFlags)
: Task(parent)
- , fName(UnderJoin(parent.name().c_str(), "replay"))
+ , fName(UnderJoin(parent.name().c_str(), flags_name(recordFlags)))
, fGM(gm)
, fReference(reference)
+ , fRecordFlags(recordFlags)
{}
void ReplayTask::draw() {
SkPicture recorded;
- RecordPicture(fGM.get(), &recorded);
+ RecordPicture(fGM.get(), &recorded, fRecordFlags);
SkBitmap bitmap;
SetupBitmap(fReference.config(), fGM.get(), &bitmap);
@@ -32,7 +46,17 @@ void ReplayTask::draw() {
}
bool ReplayTask::shouldSkip() const {
- return !FLAGS_replay || fGM->getFlags() & skiagm::GM::kSkipPicture_Flag;
+ if (fGM->getFlags() & skiagm::GM::kSkipPicture_Flag) {
+ return true;
+ }
+
+ if (FLAGS_rtree && flags_name(fRecordFlags) == kRTree) {
epoger 2013/10/30 19:37:01 It seems very strange to me that we change code pa
+ return false;
epoger 2013/10/30 19:37:01 Maybe it's just me, but I would find it easier to
+ }
+ if (FLAGS_replay && flags_name(fRecordFlags) == kReplay) {
epoger 2013/10/30 19:37:01 Here and above, please put in more parentheses. N
+ return false;
+ }
+ return true;
}
} // namespace DM

Powered by Google App Engine
This is Rietveld 408576698