diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-06 19:48:02 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-05-06 19:48:02 +0000 |
commit | 93043bc252929d38a38096bba12f4612a8626c9b (patch) | |
tree | 6f6bb3c57c44ec9201aaf36e931b135c2c5b118b /dm | |
parent | 901c43c26f775eddd665ad03ce0e09fbd82514ed (diff) |
DM: test SkRecord with and without optimization.
BUG=skia:2378
R=fmalita@chromium.org, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/271443007
git-svn-id: http://skia.googlecode.com/svn/trunk@14598 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'dm')
-rw-r--r-- | dm/DMCpuGMTask.cpp | 3 | ||||
-rw-r--r-- | dm/DMRecordTask.cpp | 25 | ||||
-rw-r--r-- | dm/DMRecordTask.h | 3 |
3 files changed, 21 insertions, 10 deletions
diff --git a/dm/DMCpuGMTask.cpp b/dm/DMCpuGMTask.cpp index e1ba81d1c1..071697b8c4 100644 --- a/dm/DMCpuGMTask.cpp +++ b/dm/DMCpuGMTask.cpp @@ -40,7 +40,8 @@ void CpuGMTask::draw() { SPAWN(PipeTask, fGMFactory(NULL), bitmap, true, false); SPAWN(PipeTask, fGMFactory(NULL), bitmap, true, true); SPAWN(QuiltTask, fGMFactory(NULL), bitmap); - SPAWN(RecordTask, fGMFactory(NULL), bitmap); + SPAWN(RecordTask, fGMFactory(NULL), bitmap, true); + SPAWN(RecordTask, fGMFactory(NULL), bitmap, false); SPAWN(ReplayTask, fGMFactory(NULL), bitmap, false); SPAWN(ReplayTask, fGMFactory(NULL), bitmap, true); SPAWN(SerializeTask, fGMFactory(NULL), bitmap); diff --git a/dm/DMRecordTask.cpp b/dm/DMRecordTask.cpp index d1c552f569..531fe57f94 100644 --- a/dm/DMRecordTask.cpp +++ b/dm/DMRecordTask.cpp @@ -2,31 +2,40 @@ #include "DMUtil.h" #include "DMWriteTask.h" #include "SkCommandLineFlags.h" -#include "SkRecording.h" +#include "SkRecord.h" +#include "SkRecordDraw.h" +#include "SkRecordOpts.h" +#include "SkRecorder.h" DEFINE_bool(skr, true, "If true, run SKR tests."); namespace DM { -RecordTask::RecordTask(const Task& parent, skiagm::GM* gm, SkBitmap reference) +RecordTask::RecordTask(const Task& parent, skiagm::GM* gm, SkBitmap reference, bool optimize) : CpuTask(parent) - , fName(UnderJoin(parent.name().c_str(), "skr")) + , fName(UnderJoin(parent.name().c_str(), optimize ? "skr" : "skr-noopt")) , fGM(gm) , fReference(reference) + , fOptimize(optimize) {} void RecordTask::draw() { // Record the GM into an SkRecord. - EXPERIMENTAL::SkRecording recording(fReference.width(), fReference.height()); - recording.canvas()->concat(fGM->getInitialTransform()); - fGM->draw(recording.canvas()); - SkAutoTDelete<const EXPERIMENTAL::SkPlayback> playback(recording.releasePlayback()); + SkRecord record; + SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, + fReference.width(), fReference.height()); + recorder.concat(fGM->getInitialTransform()); + fGM->draw(&recorder); + + if (fOptimize) { + SkRecordOptimize(&record); + } // Draw the SkRecord back into a bitmap. SkBitmap bitmap; SetupBitmap(fReference.colorType(), fGM.get(), &bitmap); SkCanvas target(bitmap); - playback->draw(&target); + SkRecordDraw(record, &target); if (!BitmapsEqual(bitmap, fReference)) { this->fail(); diff --git a/dm/DMRecordTask.h b/dm/DMRecordTask.h index 7efd951e0f..94ac412e42 100644 --- a/dm/DMRecordTask.h +++ b/dm/DMRecordTask.h @@ -14,7 +14,7 @@ namespace DM { class RecordTask : public CpuTask { public: - RecordTask(const Task& parent, skiagm::GM*, SkBitmap reference); + RecordTask(const Task& parent, skiagm::GM*, SkBitmap reference, bool optimize); virtual void draw() SK_OVERRIDE; virtual bool shouldSkip() const SK_OVERRIDE; @@ -24,6 +24,7 @@ private: const SkString fName; SkAutoTDelete<skiagm::GM> fGM; const SkBitmap fReference; + bool fOptimize; }; } // namespace DM |