aboutsummaryrefslogtreecommitdiffhomepage
path: root/samplecode/SampleCowboy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'samplecode/SampleCowboy.cpp')
-rw-r--r--samplecode/SampleCowboy.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/samplecode/SampleCowboy.cpp b/samplecode/SampleCowboy.cpp
index b1eec87e50..bd8f7c909b 100644
--- a/samplecode/SampleCowboy.cpp
+++ b/samplecode/SampleCowboy.cpp
@@ -37,12 +37,13 @@ protected:
};
void onOnceBeforeDraw() override {
- fPath = GetResourcePath("Cowboy.svg");
- SkFILEStream svgStream(fPath.c_str());
- if (!svgStream.isValid()) {
- SkDebugf("file not found: \"path\"\n", fPath.c_str());
+ constexpr char path[] = "Cowboy.svg";
+ auto data = GetResourceAsData(path);
+ if (!data) {
+ SkDebugf("file not found: \"%s\"\n", path);
return;
}
+ SkMemoryStream svgStream(std::move(data));
SkDOM xmlDom;
if (!xmlDom.build(svgStream)) {