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
This commit is contained in:
keyar@chromium.org 2012-07-16 17:29:16 +00:00
Родитель 2e41becaa9
Коммит a2333d9703
2 изменённых файлов: 28 добавлений и 1 удалений

Просмотреть файл

@ -70,6 +70,11 @@
'type': 'executable',
'sources': [
'../tools/render_pictures_main.cpp',
'../src/pipe/utils/SamplePipeControllers.h',
'../src/pipe/utils/SamplePipeControllers.cpp',
],
'include_dirs': [
'../src/pipe/utils/',
],
'dependencies': [
'core.gyp:core',

Просмотреть файл

@ -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));
}
}
}