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

Unified Diff: tools/render_pictures_main.cpp

Issue 202983003: add --writeChecksumBasedFilenames flag to render_pictures (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: pass SkString pointers to init Created 6 years, 9 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/bbh_shootout.cpp ('k') | tools/tests/render_pictures_test.py » ('j') | 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 a8c393f985702aa29a9b267659cdd7415f23d530..4e51bfa66ecb58a0817042207a08f003c46da297 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -29,6 +29,8 @@ DEFINE_int32(maxComponentDiff, 256, "Maximum diff on a component, 0 - 256. Compo
"by more than this amount are considered errors, though all diffs are reported. "
"Requires --validate.");
DECLARE_string(readPath);
+DEFINE_bool(writeChecksumBasedFilenames, false,
+ "When writing out images, use checksum-based filenames.");
DEFINE_bool(writeEncodedImages, false, "Any time the skp contains an encoded image, write it to a "
"file rather than decoding it. Requires writePath to be set. Skips drawing the full "
"skp to a file. Not compatible with deferImageDecoding.");
@@ -145,6 +147,10 @@ static bool render_picture_internal(const SkString& inputPath, const SkString* o
SkBitmap** out) {
SkString inputFilename;
sk_tools::get_basename(&inputFilename, inputPath);
+ SkString outputDirString;
+ if (NULL != outputDir && outputDir->size() > 0 && !FLAGS_writeEncodedImages) {
+ outputDirString.set(*outputDir);
+ }
SkFILEStream inputStream;
inputStream.setPath(inputPath.c_str());
@@ -189,7 +195,7 @@ static bool render_picture_internal(const SkString& inputPath, const SkString* o
SkDebugf("drawing... [%i %i] %s\n", picture->width(), picture->height(),
inputPath.c_str());
- renderer.init(picture);
+ renderer.init(picture, &outputDirString, &inputFilename, FLAGS_writeChecksumBasedFilenames);
if (FLAGS_preprocess) {
if (NULL != renderer.getCanvas()) {
@@ -199,18 +205,9 @@ static bool render_picture_internal(const SkString& inputPath, const SkString* o
renderer.setup();
- SkString* outputPath = NULL;
- if (NULL != outputDir && outputDir->size() > 0 && !FLAGS_writeEncodedImages) {
- outputPath = SkNEW(SkString);
- make_output_filepath(outputPath, *outputDir, inputFilename);
- }
-
- bool success = renderer.render(outputPath, out);
- if (outputPath) {
- if (!success) {
- SkDebugf("Could not write to file %s\n", outputPath->c_str());
- }
- SkDELETE(outputPath);
+ bool success = renderer.render(out);
+ if (!success) {
+ SkDebugf("Failed to render %s\n", inputFilename.c_str());
}
renderer.end();
@@ -352,13 +349,13 @@ static bool render_picture(const SkString& inputPath, const SkString* outputDir,
sk_tools::force_all_opaque(*bitmap);
if (NULL != jsonSummaryPtr) {
- // EPOGER: This is a hacky way of constructing the filename associated with the
+ // TODO(epoger): This is a hacky way of constructing the filename associated with the
// image checksum; we basically are repeating the logic of make_output_filepath()
// and code below here, within here.
// It would be better for the filename (without outputDir) to be passed in here,
// and used both for the checksum file and writing into outputDir.
//
- // EPOGER: what about including the config type within hashFilename? That way,
+ // TODO(epoger): what about including the config type within hashFilename? That way,
// we could combine results of different config types without conflicting filenames.
SkString hashFilename;
sk_tools::get_basename(&hashFilename, inputPath);
« no previous file with comments | « tools/bbh_shootout.cpp ('k') | tools/tests/render_pictures_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698