diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-10-30 20:45:28 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-10-30 20:45:28 +0000 |
commit | c1362424b864ee3ae7aa44971985e5481057363a (patch) | |
tree | 5a1904317551f11ceccb7f3ab0c5565f1b3f949f /dm | |
parent | c9424b8e6dc204fc304c021480a04a468899aa34 (diff) |
DM: add --rtree.
BUG=
R=epoger@google.com
Author: mtklein@google.com
Review URL: https://codereview.chromium.org/51243003
git-svn-id: http://skia.googlecode.com/svn/trunk@12033 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'dm')
-rw-r--r-- | dm/DMCpuTask.cpp | 4 | ||||
-rw-r--r-- | dm/DMReplayTask.cpp | 22 | ||||
-rw-r--r-- | dm/DMReplayTask.h | 8 | ||||
-rw-r--r-- | dm/DMUtil.cpp | 4 | ||||
-rw-r--r-- | dm/DMUtil.h | 4 | ||||
-rw-r--r-- | dm/README | 1 |
6 files changed, 30 insertions, 13 deletions
diff --git a/dm/DMCpuTask.cpp b/dm/DMCpuTask.cpp index 7e6f909ff3..1d1d4010f7 100644 --- a/dm/DMCpuTask.cpp +++ b/dm/DMCpuTask.cpp @@ -38,7 +38,9 @@ void CpuTask::draw() { this->spawnChild(SkNEW_ARGS(PipeTask, (*this, fGMFactory(NULL), bitmap, true, false))); this->spawnChild(SkNEW_ARGS(PipeTask, (*this, fGMFactory(NULL), bitmap, true, true))); - this->spawnChild(SkNEW_ARGS(ReplayTask, (*this, fGMFactory(NULL), bitmap))); + this->spawnChild(SkNEW_ARGS(ReplayTask, (*this, fGMFactory(NULL), bitmap, true))); + this->spawnChild(SkNEW_ARGS(ReplayTask, (*this, fGMFactory(NULL), bitmap, false))); + this->spawnChild(SkNEW_ARGS(SerializeTask, (*this, fGMFactory(NULL), bitmap))); this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap))); } diff --git a/dm/DMReplayTask.cpp b/dm/DMReplayTask.cpp index a0ecf5fadf..0ec9e250d9 100644 --- a/dm/DMReplayTask.cpp +++ b/dm/DMReplayTask.cpp @@ -6,21 +6,25 @@ #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 { ReplayTask::ReplayTask(const Task& parent, skiagm::GM* gm, - SkBitmap reference) + SkBitmap reference, + bool useRTree) : Task(parent) - , fName(UnderJoin(parent.name().c_str(), "replay")) + , fName(UnderJoin(parent.name().c_str(), useRTree ? "rtree" : "replay")) , fGM(gm) , fReference(reference) + , fUseRTree(useRTree) {} void ReplayTask::draw() { SkPicture recorded; - RecordPicture(fGM.get(), &recorded); + const uint32_t flags = fUseRTree ? SkPicture::kOptimizeForClippedPlayback_RecordingFlag : 0; + RecordPicture(fGM.get(), &recorded, flags); SkBitmap bitmap; SetupBitmap(fReference.config(), fGM.get(), &bitmap); @@ -32,7 +36,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 && fUseRTree) { + return false; + } + if (FLAGS_replay && !fUseRTree) { + return false; + } + return true; } } // namespace DM diff --git a/dm/DMReplayTask.h b/dm/DMReplayTask.h index bf90f72a0e..1217c07396 100644 --- a/dm/DMReplayTask.h +++ b/dm/DMReplayTask.h @@ -14,9 +14,10 @@ namespace DM { class ReplayTask : public Task { public: - ReplayTask(const Task& parent, - skiagm::GM*, - SkBitmap reference); + ReplayTask(const Task& parent, // ReplayTask must be a child task. Pass its parent here. + skiagm::GM*, // GM to run through a pipe. Takes ownership. + SkBitmap reference, // Bitmap to compare pipe results to. + bool useRTree); // Record with an RTree? virtual void draw() SK_OVERRIDE; virtual bool usesGpu() const SK_OVERRIDE { return false; } @@ -27,6 +28,7 @@ private: const SkString fName; SkAutoTDelete<skiagm::GM> fGM; const SkBitmap fReference; + const bool fUseRTree; }; } // namespace DM diff --git a/dm/DMUtil.cpp b/dm/DMUtil.cpp index a227ca8584..d5214849e6 100644 --- a/dm/DMUtil.cpp +++ b/dm/DMUtil.cpp @@ -23,10 +23,10 @@ bool MeetsExpectations(const skiagm::Expectations& expectations, const SkBitmap return expectations.match(digest); } -void RecordPicture(skiagm::GM* gm, SkPicture* picture) { +void RecordPicture(skiagm::GM* gm, SkPicture* picture, uint32_t recordFlags) { SkCanvas* canvas = picture->beginRecording(SkScalarCeilToInt(gm->width()), SkScalarCeilToInt(gm->height()), - 0 /*flags*/); + recordFlags); canvas->concat(gm->getInitialTransform()); gm->draw(canvas); canvas->flush(); diff --git a/dm/DMUtil.h b/dm/DMUtil.h index 4dd9dd83ae..512ad64eb6 100644 --- a/dm/DMUtil.h +++ b/dm/DMUtil.h @@ -18,8 +18,8 @@ SkString Png(SkString s); // Roughly, expectations.match(GmResultDigest(bitmap)), but calculates the digest lazily. bool MeetsExpectations(const skiagm::Expectations& expectations, const SkBitmap bitmap); -// Draw gm to picture. -void RecordPicture(skiagm::GM* gm, SkPicture* picture); +// Draw gm to picture. Passes recordFlags to SkPicture::beginRecording(). +void RecordPicture(skiagm::GM* gm, SkPicture* picture, uint32_t recordFlags = 0); // Prepare bitmap to have gm draw into it with this config. void SetupBitmap(const SkBitmap::Config config, skiagm::GM* gm, SkBitmap* bitmap); @@ -7,7 +7,6 @@ Current approximate list of missing features: --writePicturePath --deferred - --rtree --tiledGrid |