Index: tools/render_pictures_main.cpp |
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp |
index e2f772908f7f3abde45cc04ce365341821e11c7e..23d973f901092989b2a6c0f64f92d23e7e33a395 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; |
} |