Refactor how we handle resources path in Tests.
This idea emerged while doing https://codereview.chromium.org/321723002/
(commit 880914c35c8f7fc2e9c57134134c883baf66e538).
BUG=None
TEST=make tests && out/Debug/tests
R=mtklein@google.com
Author: tfarina@chromium.org
Review URL: https://codereview.chromium.org/346453002
diff --git a/bench/ETCBitmapBench.cpp b/bench/ETCBitmapBench.cpp
index e9aee76..d5f32db 100644
--- a/bench/ETCBitmapBench.cpp
+++ b/bench/ETCBitmapBench.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "Resources.h"
#include "SkBenchmark.h"
#include "SkCanvas.h"
#include "SkData.h"
diff --git a/bench/SkBenchmark.cpp b/bench/SkBenchmark.cpp
index d1f0639..4c5d077 100644
--- a/bench/SkBenchmark.cpp
+++ b/bench/SkBenchmark.cpp
@@ -4,7 +4,9 @@
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+
#include "SkBenchmark.h"
+
#include "SkPaint.h"
#include "SkParse.h"
@@ -12,8 +14,6 @@
template BenchRegistry* BenchRegistry::gHead;
-const char* SkBenchmark::gResourcePath;
-
SkBenchmark::SkBenchmark() {
fForceAlpha = 0xFF;
fForceAA = true;
@@ -51,16 +51,6 @@
}
}
-void SkBenchmark::SetResourcePath(const char* resourcePath) {
- gResourcePath = resourcePath;
-}
-
-SkString SkBenchmark::GetResourcePath() {
- return SkString(gResourcePath);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
SkIPoint SkBenchmark::onGetSize() {
return SkIPoint::Make(640, 480);
}
diff --git a/bench/SkBenchmark.h b/bench/SkBenchmark.h
index e86c81b..012d0fd 100644
--- a/bench/SkBenchmark.h
+++ b/bench/SkBenchmark.h
@@ -102,9 +102,6 @@
fClearMask = clearMask;
}
- static void SetResourcePath(const char*);
- static SkString GetResourcePath();
-
protected:
virtual void setupPaint(SkPaint* paint);
@@ -122,7 +119,6 @@
bool fForceFilter;
SkTriState::State fDither;
uint32_t fOrMask, fClearMask;
- static const char* gResourcePath;
typedef SkRefCnt INHERITED;
};
diff --git a/bench/SkipZeroesBench.cpp b/bench/SkipZeroesBench.cpp
index b84cf78..46acb9f 100644
--- a/bench/SkipZeroesBench.cpp
+++ b/bench/SkipZeroesBench.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "Resources.h"
#include "SkBenchmark.h"
#include "SkBitmap.h"
#include "SkData.h"
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index 078a2e8..b82dd01 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -255,7 +255,6 @@
"Ratio of subsequent bench measurements must drop within 1±error to converge.");
DEFINE_string(timeFormat, "%9.2f", "Format to print results, in milliseconds per 1000 loops.");
DEFINE_bool2(verbose, v, false, "Print more.");
-DEFINE_string2(resourcePath, i, "resources", "directory for test resources.");
DEFINE_string(outResultsFile, "", "If given, the results will be written to the file in JSON format.");
DEFINE_bool(dryRun, false, "Don't actually run the tests, just print what would have been done.");
@@ -347,10 +346,6 @@
}
}
}
- // Set the resource path.
- if (!FLAGS_resourcePath.isEmpty()) {
- SkBenchmark::SetResourcePath(FLAGS_resourcePath[0]);
- }
#if SK_SUPPORT_GPU
for (int i = 0; i < configs.count(); ++i) {