skia2/dm/DMCpuGMTask.cpp
commit-bot@chromium.org e3ff558a4b SkRecord strawman
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
2014-04-01 16:24:06 +00:00

63 lines
1.9 KiB
C++

#include "DMCpuGMTask.h"
#include "DMExpectationsTask.h"
#include "DMPipeTask.h"
#include "DMRecordTask.h"
#include "DMReplayTask.h"
#include "DMSerializeTask.h"
#include "DMTileGridTask.h"
#include "DMUtil.h"
#include "DMWriteTask.h"
namespace DM {
CpuGMTask::CpuGMTask(const char* config,
Reporter* reporter,
TaskRunner* taskRunner,
const Expectations& expectations,
skiagm::GMRegistry::Factory gmFactory,
SkColorType colorType)
: CpuTask(reporter, taskRunner)
, fGMFactory(gmFactory)
, fGM(fGMFactory(NULL))
, fName(UnderJoin(fGM->getName(), config))
, fExpectations(expectations)
, fColorType(colorType)
{}
void CpuGMTask::draw() {
SkBitmap bitmap;
SetupBitmap(fColorType, fGM.get(), &bitmap);
SkCanvas canvas(bitmap);
canvas.concat(fGM->getInitialTransform());
fGM->draw(&canvas);
canvas.flush();
#define SPAWN(ChildTask, ...) this->spawnChild(SkNEW_ARGS(ChildTask, (*this, __VA_ARGS__)))
SPAWN(ExpectationsTask, fExpectations, bitmap);
SPAWN(PipeTask, fGMFactory(NULL), bitmap, false, false);
SPAWN(PipeTask, fGMFactory(NULL), bitmap, true, false);
SPAWN(PipeTask, fGMFactory(NULL), bitmap, true, true);
SPAWN(RecordTask, fGMFactory(NULL), bitmap);
SPAWN(ReplayTask, fGMFactory(NULL), bitmap, false);
SPAWN(ReplayTask, fGMFactory(NULL), bitmap, true);
SPAWN(SerializeTask, fGMFactory(NULL), bitmap);
SPAWN(TileGridTask, fGMFactory(NULL), bitmap, SkISize::Make(16,16));
SPAWN(WriteTask, bitmap);
#undef SPAWN
}
bool CpuGMTask::shouldSkip() const {
if (kRGB_565_SkColorType == fColorType && (fGM->getFlags() & skiagm::GM::kSkip565_Flag)) {
return true;
}
if (fGM->getFlags() & skiagm::GM::kGPUOnly_Flag) {
return true;
}
return false;
}
} // namespace DM