diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-12-10 16:05:09 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-12-10 16:05:09 +0000 |
commit | 5a34fd3f9876174aea8b22e1b585b4244e71b0b1 (patch) | |
tree | 3aaa0d7586c0ad1ab40e1868a5080c61f4d0d9f7 /tools | |
parent | 907ef6c7024c7aa04cb8822b0d06a458e551bc89 (diff) |
add '--mode clone' option to bench_pictures
git-svn-id: http://skia.googlecode.com/svn/trunk@6735 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools')
-rw-r--r-- | tools/PictureRenderer.cpp | 27 | ||||
-rw-r--r-- | tools/PictureRenderer.h | 1 | ||||
-rw-r--r-- | tools/bench_pictures_main.cpp | 2 |
3 files changed, 28 insertions, 2 deletions
diff --git a/tools/PictureRenderer.cpp b/tools/PictureRenderer.cpp index 3f96e90962..e3ac187f66 100644 --- a/tools/PictureRenderer.cpp +++ b/tools/PictureRenderer.cpp @@ -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 diff --git a/tools/PictureRenderer.h b/tools/PictureRenderer.h index 8bce978bf9..192569cece 100644 --- a/tools/PictureRenderer.h +++ b/tools/PictureRenderer.h @@ -368,6 +368,7 @@ private: }; extern PictureRenderer* CreateGatherPixelRefsRenderer(); +extern PictureRenderer* CreatePictureCloneRenderer(); } diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp index c1d0e1c0b3..47844f9417 100644 --- a/tools/bench_pictures_main.cpp +++ b/tools/bench_pictures_main.cpp @@ -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")) |