e3ff558a4b
Record performance as measured by bench_record (out/Release/bench_record --skr) improves by at least 1.9x, at most 6.7x, arithmetic mean 2.6x, geometric mean 3.0x. So, good. Correctness as measured by DM (out/Debug/dm --skr) is ~ok. One GM (shadertext2) fails because we're assuming all paint effects are immutable, but SkShaders are still mutable. To do after this CL: - measure playback speed - catch up feature-wise to SkPicture - match today's playback speed BUG=skia: R=robertphillips@google.com, bsalomon@google.com, reed@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/206313003 git-svn-id: http://skia.googlecode.com/svn/trunk@14010 2bbb7eff-a529-9590-31e7-b0007b416f81
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
#include "DMRecordTask.h"
|
|
#include "DMUtil.h"
|
|
#include "DMWriteTask.h"
|
|
#include "SkCommandLineFlags.h"
|
|
#include "SkRecordDraw.h"
|
|
#include "SkRecorder.h"
|
|
|
|
DEFINE_bool(skr, false, "If true, run SKR tests.");
|
|
|
|
namespace DM {
|
|
|
|
RecordTask::RecordTask(const Task& parent, skiagm::GM* gm, SkBitmap reference)
|
|
: CpuTask(parent)
|
|
, fName(UnderJoin(parent.name().c_str(), "skr"))
|
|
, fGM(gm)
|
|
, fReference(reference)
|
|
{}
|
|
|
|
void RecordTask::draw() {
|
|
// Record the GM into an SkRecord.
|
|
SkRecord record;
|
|
SkRecorder canvas(&record, fReference.width(), fReference.height());
|
|
canvas.concat(fGM->getInitialTransform());
|
|
fGM->draw(&canvas);
|
|
|
|
// Draw the SkRecord back into a bitmap.
|
|
SkBitmap bitmap;
|
|
SetupBitmap(fReference.colorType(), fGM.get(), &bitmap);
|
|
SkCanvas target(bitmap);
|
|
record.visit(SkRecordDraw(&target));
|
|
|
|
if (!BitmapsEqual(bitmap, fReference)) {
|
|
this->fail();
|
|
this->spawnChild(SkNEW_ARGS(WriteTask, (*this, bitmap)));
|
|
}
|
|
}
|
|
|
|
bool RecordTask::shouldSkip() const {
|
|
return !FLAGS_skr;
|
|
}
|
|
|
|
} // namespace DM
|