diff options
author | 2014-05-06 19:48:02 +0000 | |
---|---|---|
committer | 2014-05-06 19:48:02 +0000 | |
commit | 93043bc252929d38a38096bba12f4612a8626c9b (patch) | |
tree | 6f6bb3c57c44ec9201aaf36e931b135c2c5b118b /dm/DMRecordTask.cpp | |
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/DMRecordTask.cpp')
-rw-r--r-- | dm/DMRecordTask.cpp | 25 |
1 files changed, 17 insertions, 8 deletions
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(); |