diff options
Diffstat (limited to 'samplecode')
-rw-r--r-- | samplecode/SampleCowboy.cpp | 9 | ||||
-rw-r--r-- | samplecode/SampleIdentityScale.cpp | 9 | ||||
-rw-r--r-- | samplecode/SampleSubpixelTranslate.cpp | 18 |
3 files changed, 18 insertions, 18 deletions
diff --git a/samplecode/SampleCowboy.cpp b/samplecode/SampleCowboy.cpp index bd8f7c909b..b1eec87e50 100644 --- a/samplecode/SampleCowboy.cpp +++ b/samplecode/SampleCowboy.cpp @@ -37,13 +37,12 @@ protected: }; void onOnceBeforeDraw() override { - constexpr char path[] = "Cowboy.svg"; - auto data = GetResourceAsData(path); - if (!data) { - SkDebugf("file not found: \"%s\"\n", path); + fPath = GetResourcePath("Cowboy.svg"); + SkFILEStream svgStream(fPath.c_str()); + if (!svgStream.isValid()) { + SkDebugf("file not found: \"path\"\n", fPath.c_str()); return; } - SkMemoryStream svgStream(std::move(data)); SkDOM xmlDom; if (!xmlDom.build(svgStream)) { diff --git a/samplecode/SampleIdentityScale.cpp b/samplecode/SampleIdentityScale.cpp index ad235416cd..2ec9112800 100644 --- a/samplecode/SampleIdentityScale.cpp +++ b/samplecode/SampleIdentityScale.cpp @@ -25,10 +25,11 @@ class IdentityScaleView : public SampleView { public: IdentityScaleView(const char imageFilename[]) { - if (!DecodeDataToBitmap(GetResourceAsData(imageFilename), &fBM)) { - fBM.allocN32Pixels(1, 1); - *(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad - } + SkString resourcePath = GetResourcePath(imageFilename); + if (!decode_file(resourcePath.c_str(), &fBM)) { + fBM.allocN32Pixels(1, 1); + *(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad + } } protected: diff --git a/samplecode/SampleSubpixelTranslate.cpp b/samplecode/SampleSubpixelTranslate.cpp index 7ce1885892..51b5ef6631 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) - { - if (!DecodeDataToBitmap(GetResourceAsData(imageFilename), &fBM)) { - fBM.allocN32Pixels(1, 1); - *(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad - } - fCurPos = SkPoint::Make(0,0); - fSize = 200; + : 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; } protected: |