diff options
author | robertphillips <robertphillips@google.com> | 2014-08-12 10:12:40 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-12 10:12:40 -0700 |
commit | e94707505e9007c05f67d813bdb2b6eccaf96c06 (patch) | |
tree | 54a1dff13d94876887d07ce00531df3d304dc451 /tools | |
parent | dea60f6db3b454b5f6db35032c82163c3b00ad46 (diff) |
Update tools for use of picture stats in GPU optimization decision
R=bsalomon@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/466733004
Diffstat (limited to 'tools')
-rw-r--r-- | tools/bench_pictures_main.cpp | 8 | ||||
-rw-r--r-- | tools/render_pictures_main.cpp | 11 |
2 files changed, 17 insertions, 2 deletions
diff --git a/tools/bench_pictures_main.cpp b/tools/bench_pictures_main.cpp index b740877cce..ac66dc50d6 100644 --- a/tools/bench_pictures_main.cpp +++ b/tools/bench_pictures_main.cpp @@ -197,6 +197,14 @@ static bool run_single_benchmark(const SkString& inputPath, return false; } + if (FLAGS_preprocess) { + // Because the GPU preprocessing step relies on the in-memory picture + // statistics we need to rerecord the picture here + SkPictureRecorder recorder; + picture->draw(recorder.beginRecording(picture->width(), picture->height(), NULL, 0)); + picture.reset(recorder.endRecording()); + } + SkString filename = SkOSPath::Basename(inputPath.c_str()); gWriter.bench(filename.c_str(), picture->width(), picture->height()); diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp index e2f772908f..23d973f901 100644 --- a/tools/render_pictures_main.cpp +++ b/tools/render_pictures_main.cpp @@ -172,13 +172,21 @@ static bool render_picture_internal(const SkString& inputPath, const SkString* w SkDebugf("deserializing... %s\n", inputPath.c_str()); - SkPicture* picture = SkPicture::CreateFromStream(&inputStream, proc); + SkAutoTUnref<SkPicture> picture(SkPicture::CreateFromStream(&inputStream, proc)); if (NULL == picture) { SkDebugf("Could not read an SkPicture from %s\n", inputPath.c_str()); return false; } + if (FLAGS_preprocess) { + // Because the GPU preprocessing step relies on the in-memory picture + // statistics we need to rerecord the picture here + SkPictureRecorder recorder; + picture->draw(recorder.beginRecording(picture->width(), picture->height(), NULL, 0)); + picture.reset(recorder.endRecording()); + } + while (FLAGS_bench_record) { SkPictureRecorder recorder; picture->draw(recorder.beginRecording(picture->width(), picture->height(), NULL, 0)); @@ -207,7 +215,6 @@ static bool render_picture_internal(const SkString& inputPath, const SkString* w renderer.end(); - SkDELETE(picture); return success; } |