aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/PictureRenderer.cpp27
-rw-r--r--tools/PictureRenderer.h1
-rw-r--r--tools/bench_pictures_main.cpp2
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"))