Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(141)

Unified Diff: tools/render_pictures_main.cpp

Issue 17113004: Replace SkPicture(SkStream) constructors with a factory. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove a change in behavior Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/render_pdfs_main.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
« no previous file with comments | « tools/render_pdfs_main.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698