diff options
author | 2014-05-14 17:55:32 +0000 | |
---|---|---|
committer | 2014-05-14 17:55:32 +0000 | |
commit | 90b5a2a653b312ff9bcd7102412da2dbeb52368c (patch) | |
tree | 2451f6fb4fb929d027741168eef00bc55e249ea2 /dm/DMRecordTask.cpp | |
parent | ddb9331443dbec705a4394e4f298a1090e471ba1 (diff) |
DM: Add --skps.
This does render_pictures, plus checks SkRecord optimizations.
Disable an SkRecord optimization that draws several bot SKPs wrong. (To be investigated.)
BUG=skia:2378
R=reed@google.com, mtklein@google.com
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/270543004
git-svn-id: http://skia.googlecode.com/svn/trunk@14739 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'dm/DMRecordTask.cpp')
-rw-r--r-- | dm/DMRecordTask.cpp | 32 |
1 files changed, 25 insertions, 7 deletions
diff --git a/dm/DMRecordTask.cpp b/dm/DMRecordTask.cpp index 531fe57f94..ce27aaa6f9 100644 --- a/dm/DMRecordTask.cpp +++ b/dm/DMRecordTask.cpp @@ -11,21 +11,35 @@ DEFINE_bool(skr, true, "If true, run SKR tests."); namespace DM { -RecordTask::RecordTask(const Task& parent, skiagm::GM* gm, SkBitmap reference, bool optimize) +RecordTask::RecordTask(const Task& parent, skiagm::GM* gm, SkBitmap reference, Mode mode) : CpuTask(parent) - , fName(UnderJoin(parent.name().c_str(), optimize ? "skr" : "skr-noopt")) + , fOptimize(mode == kOptimize_Mode) + , fName(UnderJoin(parent.name().c_str(), fOptimize ? "skr" : "skr-noopt")) , fGM(gm) , fReference(reference) - , fOptimize(optimize) + {} + +RecordTask::RecordTask(const Task& parent, SkPicture* pic, SkBitmap reference, Mode mode) + : CpuTask(parent) + , fOptimize(mode == kOptimize_Mode) + , fName(UnderJoin(parent.name().c_str(), fOptimize ? "skr" : "skr-noopt")) + , fPicture(SkRef(pic)) + , fReference(reference) {} void RecordTask::draw() { - // Record the GM into an SkRecord. + // Record into an SkRecord. SkRecord record; SkRecorder recorder(SkRecorder::kWriteOnly_Mode, &record, fReference.width(), fReference.height()); - recorder.concat(fGM->getInitialTransform()); - fGM->draw(&recorder); + + if (fGM.get()) { + recorder.concat(fGM->getInitialTransform()); + fGM->draw(&recorder); + } else { + fPicture->draw(&recorder); + } + if (fOptimize) { SkRecordOptimize(&record); @@ -33,7 +47,11 @@ void RecordTask::draw() { // Draw the SkRecord back into a bitmap. SkBitmap bitmap; - SetupBitmap(fReference.colorType(), fGM.get(), &bitmap); + if (fGM.get()) { + SetupBitmap(fReference.colorType(), fGM.get(), &bitmap); + } else { + SetupBitmap(fReference.colorType(), *fPicture, &bitmap); + } SkCanvas target(bitmap); SkRecordDraw(record, &target); |