Index: tools/render_pictures_main.cpp |
diff --git a/tools/render_pictures_main.cpp b/tools/render_pictures_main.cpp |
index f06cfeb1481d490be3a3b057fdd401dfab489ddc..53c30723ab880e739ebc66a959358d2377b52122 100644 |
--- a/tools/render_pictures_main.cpp |
+++ b/tools/render_pictures_main.cpp |
@@ -149,19 +149,20 @@ static bool render_picture(const SkString& inputPath, const SkString* outputDir, |
return false; |
} |
- bool success = false; |
- SkPicture* picture; |
+ SkPicture::InstallPixelRefProc proc; |
if (FLAGS_deferImageDecoding) { |
- picture = SkNEW_ARGS(SkPicture, (&inputStream, &success, &lazy_decode_bitmap)); |
+ proc = &lazy_decode_bitmap; |
} else if (FLAGS_writeEncodedImages) { |
SkASSERT(!FLAGS_writePath.isEmpty()); |
reset_image_file_base_name(inputFilename); |
- picture = SkNEW_ARGS(SkPicture, (&inputStream, &success, &write_image_to_file)); |
+ proc = &write_image_to_file; |
} else { |
- picture = SkNEW_ARGS(SkPicture, (&inputStream, &success, &SkImageDecoder::DecodeMemory)); |
+ proc = &SkImageDecoder::DecodeMemory; |
} |
- if (!success) { |
+ SkPicture* picture = SkPicture::CreateFromStream(&inputStream, proc); |
+ |
+ if (NULL == picture) { |
SkDebugf("Could not read an SkPicture from %s\n", inputPath.c_str()); |
return false; |
} |
@@ -184,7 +185,7 @@ static bool render_picture(const SkString& inputPath, const SkString* outputDir, |
make_output_filepath(outputPath, *outputDir, inputFilename); |
} |
- success = renderer.render(outputPath, out); |
+ bool success = renderer.render(outputPath, out); |
if (outputPath) { |
if (!success) { |
SkDebugf("Could not write to file %s\n", outputPath->c_str()); |