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/samplecode/SampleSubpixelTranslate.cpp b/samplecode/SampleSubpixelTranslate.cpp
index afb31c1..41a0f15 100644
--- a/samplecode/SampleSubpixelTranslate.cpp
+++ b/samplecode/SampleSubpixelTranslate.cpp
@@ -1,4 +1,3 @@
-
/*
* Copyright 2014 Google Inc.
*
@@ -7,10 +6,12 @@
*/
#include "gm.h"
+
+#include "Resources.h"
#include "SampleCode.h"
#include "SkBlurMaskFilter.h"
-#include "SkColorPriv.h"
#include "SkCanvas.h"
+#include "SkColorPriv.h"
#include "SkImageDecoder.h"
#include "SkRandom.h"
#include "SkStream.h"
@@ -26,12 +27,12 @@
: fFilename(imageFilename),
fHorizontalVelocity(horizontalVelocity),
fVerticalVelocity(verticalVelocity) {
- SkString path(skiagm::GM::GetResourcePath());
- path.append("/");
- path.append(fFilename);
+ SkString resourcePath = GetResourcePath();
+ resourcePath.append("/");
+ resourcePath.append(fFilename);
- SkImageDecoder *codec = NULL;
- SkFILEStream stream(path.c_str());
+ SkImageDecoder* codec = NULL;
+ SkFILEStream stream(resourcePath.c_str());
if (stream.isValid()) {
codec = SkImageDecoder::Factory(&stream);
}