add '--mode clone' option to bench_pictures

git-svn-id: http://skia.googlecode.com/svn/trunk@6735 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
reed@google.com 2012-12-10 16:05:09 +00:00
parent 907ef6c702
commit 5a34fd3f98
3 changed files with 28 additions and 2 deletions

View File

@ -669,10 +669,10 @@ public:
SkIntToScalar(fPicture->height()));
SkData* data = SkPictureUtils::GatherPixelRefs(fPicture, bounds);
SkSafeUnref(data);
return NULL == path; // we don't have anything to write
}
private:
virtual SkString getConfigNameInternal() SK_OVERRIDE {
return SkString("gather_pixelrefs");
@ -683,4 +683,27 @@ PictureRenderer* CreateGatherPixelRefsRenderer() {
return SkNEW(GatherRenderer);
}
///////////////////////////////////////////////////////////////////////////////
class PictureCloneRenderer : public PictureRenderer {
public:
virtual bool render(const SkString* path) SK_OVERRIDE {
for (int i = 0; i < 100; ++i) {
SkPicture* clone = fPicture->clone();
SkSafeUnref(clone);
}
return NULL == path; // we don't have anything to write
}
private:
virtual SkString getConfigNameInternal() SK_OVERRIDE {
return SkString("picture_clone");
}
};
PictureRenderer* CreatePictureCloneRenderer() {
return SkNEW(PictureCloneRenderer);
}
} // namespace sk_tools

View File

@ -368,6 +368,7 @@ private:
};
extern PictureRenderer* CreateGatherPixelRefsRenderer();
extern PictureRenderer* CreatePictureCloneRenderer();
}

View File

@ -378,6 +378,8 @@ static void parse_commandline(int argc, char* const argv[], SkTArray<SkString>*
if (0 == strcmp(*argv, "record")) {
renderer.reset(SkNEW(sk_tools::RecordPictureRenderer));
gridSupported = true;
} else if (0 == strcmp(*argv, "clone")) {
renderer.reset(sk_tools::CreatePictureCloneRenderer());
} else if (0 == strcmp(*argv, "simple")) {
renderer.reset(SkNEW(sk_tools::SimplePictureRenderer));
} else if ((0 == strcmp(*argv, "tile")) || (0 == strcmp(*argv, "pow2tile"))