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

Unified Diff: gm/gm_expectations.cpp

Issue 14890017: GM: include filename extension (.png) of each output file in JSON summary (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: sync_to_r9118 Created 7 years, 7 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 | « gm/gm_expectations.h ('k') | gm/gmmain.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/gm_expectations.cpp
===================================================================
--- gm/gm_expectations.cpp (revision 9118)
+++ gm/gm_expectations.cpp (working copy)
@@ -32,17 +32,24 @@
va_end(args);
}
+ SkString SkPathJoin(const char *rootPath, const char *relativePath) {
+ SkString result(rootPath);
+ if (!result.endsWith(SkPATH_SEPARATOR)) {
+ result.appendUnichar(SkPATH_SEPARATOR);
+ }
+ result.append(relativePath);
+ return result;
+ }
+
SkString make_filename(const char path[],
const char renderModeDescriptor[],
const char *name,
const char suffix[]) {
- SkString filename(path);
- if (filename.endsWith(SkPATH_SEPARATOR)) {
- filename.remove(filename.size() - 1, 1);
- }
- filename.appendf("%c%s%s.%s", SkPATH_SEPARATOR,
- name, renderModeDescriptor, suffix);
- return filename;
+ SkString filename(name);
+ filename.append(renderModeDescriptor);
+ filename.appendUnichar('.');
+ filename.append(suffix);
+ return SkPathJoin(path, filename.c_str());
}
// TODO(epoger): This currently assumes that the result SkHashDigest was
@@ -162,8 +169,7 @@
// IndividualImageExpectationsSource class...
Expectations IndividualImageExpectationsSource::get(const char *testName) {
- SkString path = make_filename(fRootDir.c_str(), "", testName,
- "png");
+ SkString path = SkPathJoin(fRootDir.c_str(), testName);
SkBitmap referenceBitmap;
bool decodedReferenceBitmap =
SkImageDecoder::DecodeFile(path.c_str(), &referenceBitmap,
« no previous file with comments | « gm/gm_expectations.h ('k') | gm/gmmain.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698