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 --- dm/DM.cpp | 8 ++------ dm/DMSrcSink.cpp | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) (limited to 'dm') diff --git a/dm/DM.cpp b/dm/DM.cpp index d2c127c133..ebd2fe4b56 100644 --- a/dm/DM.cpp +++ b/dm/DM.cpp @@ -1357,12 +1357,8 @@ int main(int argc, char** argv) { SkTaskGroup::Enabler enabled(FLAGS_threads); gCreateTypefaceDelegate = &create_from_name; - { - SkString testResourcePath = GetResourcePath("images/color_wheel.png"); - SkFILEStream testResource(testResourcePath.c_str()); - if (!testResource.isValid()) { - info("Some resources are missing. Do you need to set --resourcePath?\n"); - } + if (nullptr == GetResourceAsData("images/color_wheel.png")) { + info("Some resources are missing. Do you need to set --resourcePath?\n"); } gather_gold(); gather_uninteresting_hashes(); diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp index 89a4b531e2..96817e0749 100644 --- a/dm/DMSrcSink.cpp +++ b/dm/DMSrcSink.cpp @@ -1066,8 +1066,7 @@ Error ColorCodecSrc::draw(SkCanvas* canvas) const { } // Load the dst ICC profile. This particular dst is fairly similar to Adobe RGB. - sk_sp dstData = SkData::MakeFromFileName( - GetResourcePath("icc_profiles/HP_ZR30w.icc").c_str()); + sk_sp dstData = GetResourceAsData("icc_profiles/HP_ZR30w.icc"); if (!dstData) { return "Cannot read monitor profile. Is the resource path set correctly?"; } -- cgit v1.2.3