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

Unified Diff: tools/render_pictures_main.cpp

Issue 226293002: add explicit filepaths to render_pictures JSON summary (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 6 years, 8 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/picture_utils.cpp ('k') | tools/skimage_main.cpp » ('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 7563074e5b3a6a80b13e015d9f53b83f52dc518b..7ebbdbd3aa83b15d5fa2aaa5fb34f5f68efa5662 100644
--- a/tools/render_pictures_main.cpp
+++ b/tools/render_pictures_main.cpp
@@ -48,13 +48,6 @@ DEFINE_bool(bench_record, false, "If true, drop into an infinite loop of recordi
DEFINE_bool(preprocess, false, "If true, perform device specific preprocessing before rendering.");
-static void make_output_filepath(SkString* path, const SkString& dir,
- const SkString& name) {
- sk_tools::make_filepath(path, dir, name);
- // Remove ".skp"
- path->remove(path->size() - 4, 4);
-}
-
////////////////////////////////////////////////////////////////////////////////////////////////////
/**
@@ -348,28 +341,21 @@ static bool render_picture(const SkString& inputPath, const SkString* outputDir,
if (FLAGS_writeWholeImage) {
sk_tools::force_all_opaque(*bitmap);
+ // TODO(epoger): 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.
+ SkString inputFilename, outputPath;
+ sk_tools::get_basename(&inputFilename, inputPath);
+ sk_tools::make_filepath(&outputPath, *outputDir, inputFilename);
+ sk_tools::replace_char(&outputPath, '.', '_');
+ outputPath.append(".png");
+
if (NULL != jsonSummaryPtr) {
- // 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.
- //
- // 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);
- hashFilename.remove(hashFilename.size() - 4, 4); // Remove ".skp"
- hashFilename.append(".png");
- jsonSummaryPtr->add(hashFilename.c_str(), *bitmap);
+ SkString outputFileBasename;
+ sk_tools::get_basename(&outputFileBasename, outputPath);
+ jsonSummaryPtr->add(inputFilename.c_str(), outputFileBasename.c_str(), *bitmap);
}
if (NULL != outputDir) {
- SkString inputFilename;
- sk_tools::get_basename(&inputFilename, inputPath);
- SkString outputPath;
- make_output_filepath(&outputPath, *outputDir, inputFilename);
- outputPath.append(".png");
if (!SkImageEncoder::EncodeFile(outputPath.c_str(), *bitmap,
SkImageEncoder::kPNG_Type, 100)) {
SkDebugf("Failed to draw the picture.\n");
« no previous file with comments | « tools/picture_utils.cpp ('k') | tools/skimage_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698