Index: samplecode/SampleSubpixelTranslate.cpp |
diff --git a/samplecode/SampleSubpixelTranslate.cpp b/samplecode/SampleSubpixelTranslate.cpp |
index 7e067a6dd45ca077430068f0be3019c8c0e6daa0..3bb90562fa9ae6206b14858a1f346bf5b4b32f08 100644 |
--- a/samplecode/SampleSubpixelTranslate.cpp |
+++ b/samplecode/SampleSubpixelTranslate.cpp |
@@ -5,6 +5,7 @@ |
* found in the LICENSE file. |
*/ |
+#include "DecodeFile.h" |
#include "gm.h" |
#include "Resources.h" |
@@ -12,7 +13,6 @@ |
#include "SkBlurMaskFilter.h" |
#include "SkCanvas.h" |
#include "SkColorPriv.h" |
-#include "SkImageDecoder.h" |
#include "SkRandom.h" |
#include "SkStream.h" |
@@ -27,16 +27,7 @@ public: |
: fHorizontalVelocity(horizontalVelocity), |
fVerticalVelocity(verticalVelocity) { |
SkString resourcePath = GetResourcePath(imageFilename); |
- SkImageDecoder* codec = nullptr; |
- SkFILEStream stream(resourcePath.c_str()); |
- if (stream.isValid()) { |
- codec = SkImageDecoder::Factory(&stream); |
- } |
- if (codec) { |
- stream.rewind(); |
- codec->decode(&stream, &fBM, kN32_SkColorType, SkImageDecoder::kDecodePixels_Mode); |
- delete codec; |
- } else { |
+ if (!decode_file(resourcePath.c_str(), &fBM)) { |
fBM.allocN32Pixels(1, 1); |
*(fBM.getAddr32(0,0)) = 0xFF0000FF; // red == bad |
} |