From 5093a539def3ae09df324018f2343827009b2e05 Mon Sep 17 00:00:00 2001 From: Hal Canary Date: Fri, 8 Dec 2017 11:38:47 -0500 Subject: resources: remove most uses of GetResourcePath() Going forward, we will standardize on GetResourceAsData(), which will make it easier to run tests in environments without access to the filesystem. Also: GetResourceAsData() complains when a resource is missing. This is usually an error. Change-Id: Iaf70b71b0ca5ed8cd1a5538a60ef185ae8736188 Reviewed-on: https://skia-review.googlesource.com/82642 Reviewed-by: Hal Canary Commit-Queue: Hal Canary --- samplecode/SampleSubpixelTranslate.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'samplecode/SampleSubpixelTranslate.cpp') diff --git a/samplecode/SampleSubpixelTranslate.cpp b/samplecode/SampleSubpixelTranslate.cpp index 51b5ef6631..7ce1885892 100644 --- a/samplecode/SampleSubpixelTranslate.cpp +++ b/samplecode/SampleSubpixelTranslate.cpp @@ -24,15 +24,15 @@ public: SubpixelTranslateView(const char imageFilename[], float horizontalVelocity, float verticalVelocity) - : fHorizontalVelocity(horizontalVelocity), - fVerticalVelocity(verticalVelocity) { - SkString resourcePath = GetResourcePath(imageFilename); - if (!decode_file(resourcePath.c_str(), &fBM)) { - fBM.allocN32Pixels(1, 1); - *(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad - } - fCurPos = SkPoint::Make(0,0); - fSize = 200; + : fHorizontalVelocity(horizontalVelocity) + , fVerticalVelocity(verticalVelocity) + { + if (!DecodeDataToBitmap(GetResourceAsData(imageFilename), &fBM)) { + fBM.allocN32Pixels(1, 1); + *(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad + } + fCurPos = SkPoint::Make(0,0); + fSize = 200; } protected: -- cgit v1.2.3