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

Unified Diff: tools/skpdiff/SkDiffContext.cpp

Issue 457203003: Modify skpdiff to write diffs directly to provided directories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fixed issue that broke windows build (hopefully) Created 6 years, 4 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/skpdiff/SkDiffContext.h ('k') | tools/skpdiff/skpdiff_main.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/skpdiff/SkDiffContext.cpp
diff --git a/tools/skpdiff/SkDiffContext.cpp b/tools/skpdiff/SkDiffContext.cpp
index ea44c90da1e2efe22077bbc42c6b1d73a1353d34..42d20de19da7b831dd66c16bca4a0535caf6417a 100644
--- a/tools/skpdiff/SkDiffContext.cpp
+++ b/tools/skpdiff/SkDiffContext.cpp
@@ -14,6 +14,9 @@
#include "SkTDict.h"
#include "SkThreadPool.h"
+// from the tools directory for replace_char(...)
+#include "picture_utils.h"
+
#include "SkDiffContext.h"
#include "SkImageDiffer.h"
#include "skpdiff_util.h"
@@ -48,6 +51,10 @@ void SkDiffContext::setWhiteDiffDir(const SkString& path) {
}
}
+void SkDiffContext::setLongNames(const bool useLongNames) {
+ longNames = useLongNames;
+}
+
void SkDiffContext::setDiffers(const SkTDArray<SkImageDiffer*>& differs) {
// Delete whatever the last array of differs was
if (NULL != fDiffers) {
@@ -79,6 +86,16 @@ static SkString get_common_prefix(const SkString& a, const SkString& b) {
}
}
+static SkString get_combined_name(const SkString& a, const SkString& b) {
+ // Note (stephana): We must keep this function in sync with
+ // getImageDiffRelativeUrl() in static/loader.js (under rebaseline_server).
+ SkString result = a;
+ result.append("-vs-");
+ result.append(b);
+ sk_tools::replace_char(&result, '.', '_');
+ return result;
+}
+
void SkDiffContext::addDiff(const char* baselinePath, const char* testPath) {
// Load the images at the paths
SkBitmap baselineBitmap;
@@ -100,7 +117,13 @@ void SkDiffContext::addDiff(const char* baselinePath, const char* testPath) {
// compute the common name
SkString baseName = SkOSPath::Basename(baselinePath);
SkString testName = SkOSPath::Basename(testPath);
- newRecord->fCommonName = get_common_prefix(baseName, testName);
+
+ if (longNames) {
+ newRecord->fCommonName = get_combined_name(baseName, testName);
+ } else {
+ newRecord->fCommonName = get_common_prefix(baseName, testName);
+ }
+ newRecord->fCommonName.append(".png");
newRecord->fBaselinePath = baselinePath;
newRecord->fTestPath = testPath;
« no previous file with comments | « tools/skpdiff/SkDiffContext.h ('k') | tools/skpdiff/skpdiff_main.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698