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
This commit is contained in:
robertphillips 2014-08-12 10:12:40 -07:00 committed by Commit bot
parent dea60f6db3
commit e94707505e
2 changed files with 17 additions and 2 deletions

View File

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

View File

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