Remove uses of SkImageDecoder from samplecode
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1812323003
Review URL: https://codereview.chromium.org/1812323003
diff --git a/samplecode/SampleSubpixelTranslate.cpp b/samplecode/SampleSubpixelTranslate.cpp
index 7e067a6..3bb9056 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 @@
: 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
}