aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools
diff options
context:
space:
mode:
authorGravatar keyar@chromium.org <keyar@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-16 17:29:16 +0000
committerGravatar keyar@chromium.org <keyar@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-07-16 17:29:16 +0000
commita2333d970329e8fffb7347f758f8c421452fe858 (patch)
tree732254fb1fb9abe81340b75155a62e698981a496 /tools
parent2e41becaa90b06a17c2ac9fe30a1e34a747a87c9 (diff)
Added pipe as a rendering option for render_pictures.
I will add tiling as a rendering option and then figure out a way to not have the code duplicated between render_pictures and bench_pictures. Review URL: https://codereview.appspot.com/6392066 git-svn-id: http://skia.googlecode.com/svn/trunk@4626 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tools')
-rw-r--r--tools/render_pictures_main.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp
index 70be7edb78..5356cb631a 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -7,8 +7,10 @@
#include "SkBitmap.h"
+#include "SamplePipeControllers.h"
#include "SkCanvas.h"
#include "SkColorPriv.h"
+#include "SkGPipe.h"
#include "SkImageEncoder.h"
#include "SkOSFile.h"
#include "SkPicture.h"
@@ -76,6 +78,22 @@ static void write_output(const SkString& outputDir, const SkString& inputFilenam
}
}
+static void pipe_run(SkPicture* picture, SkCanvas* canvas) {
+ PipeController pipeController(canvas);
+ SkGPipeWriter writer;
+ SkCanvas* pipeCanvas = writer.startRecording(&pipeController);
+ pipeCanvas->drawPicture(*picture);
+ writer.endRecording();
+}
+
+static void pipe_render(SkPicture* picture, SkBitmap* bitmap) {
+ sk_tools::setup_bitmap(bitmap, picture->width(), picture->height());
+
+ SkCanvas canvas(*bitmap);
+
+ pipe_run(picture, &canvas);
+}
+
static void render_picture(const SkString& inputPath, const SkString& outputDir,
RenderFunc renderFunc) {
SkString inputFilename;
@@ -117,7 +135,11 @@ static void parse_commandline(int argc, char* const argv[], SkTArray<SkString>*
char* const* stop = argv + argc;
for (++argv; argv < stop; ++argv) {
- inputs->push_back(SkString(*argv));
+ if (0 == strcmp(*argv, "--pipe")) {
+ *renderFunc = pipe_render;
+ } else {
+ inputs->push_back(SkString(*argv));
+ }
}
}