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/DecodeFile.h b/samplecode/DecodeFile.h
new file mode 100644
index 0000000..26d5d2d
--- /dev/null
+++ b/samplecode/DecodeFile.h
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "SkBitmap.h"
+#include "SkCodec.h"
+#include "SkData.h"
+
+inline bool decode_file(const char* filename, SkBitmap* bitmap,
+        SkColorType colorType = kN32_SkColorType, bool requireUnpremul = false) {
+    SkASSERT(kIndex_8_SkColorType != colorType);
+    SkAutoTUnref<SkData> data(SkData::NewFromFileName(filename));
+    SkAutoTDelete<SkCodec> codec(SkCodec::NewFromData(data));
+    if (!codec) {
+        return false;
+    }
+
+    SkImageInfo info = codec->getInfo().makeColorType(colorType);
+    if (requireUnpremul && kPremul_SkAlphaType == info.alphaType()) {
+        info = info.makeAlphaType(kUnpremul_SkAlphaType);
+    }
+
+    if (!bitmap->tryAllocPixels(info)) {
+        return false;
+    }
+
+    return SkCodec::kSuccess == codec->getPixels(info, bitmap->getPixels(), bitmap->rowBytes());
+}
diff --git a/samplecode/SampleAll.cpp b/samplecode/SampleAll.cpp
index 7c0557f..2bbe29f 100644
--- a/samplecode/SampleAll.cpp
+++ b/samplecode/SampleAll.cpp
@@ -21,7 +21,6 @@
 #include "SkReadBuffer.h"
 #include "SkWriteBuffer.h"
 #include "SkGradientShader.h"
-#include "SkImageDecoder.h"
 #include "SkLayerRasterizer.h"
 #include "SkMath.h"
 #include "SkPath.h"
@@ -37,6 +36,7 @@
 #include "SkXfermode.h"
 
 #include <math.h>
+#include "DecodeFile.h"
 
 static inline SkPMColor rgb2gray(SkPMColor c) {
     unsigned r = SkGetPackedR32(c);
@@ -511,9 +511,9 @@
     }
 
     virtual void startTest() {
-        SkImageDecoder::DecodeFile("/Users/caryclark/Desktop/bugcirc.gif", &fBug);
-        SkImageDecoder::DecodeFile("/Users/caryclark/Desktop/tbcirc.gif", &fTb);
-        SkImageDecoder::DecodeFile("/Users/caryclark/Desktop/05psp04.gif", &fTx);
+        decode_file("/Users/caryclark/Desktop/bugcirc.gif", &fBug);
+        decode_file("/Users/caryclark/Desktop/tbcirc.gif", &fTb);
+        decode_file("/Users/caryclark/Desktop/05psp04.gif", &fTx);
     }
 
     void drawRaster(SkCanvas* canvas)  {
diff --git a/samplecode/SampleBitmapRect.cpp b/samplecode/SampleBitmapRect.cpp
index 490c6a4..0576234 100644
--- a/samplecode/SampleBitmapRect.cpp
+++ b/samplecode/SampleBitmapRect.cpp
@@ -11,7 +11,6 @@
 #include "SkCanvas.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkPath.h"
 #include "SkRegion.h"
 #include "SkShader.h"
diff --git a/samplecode/SampleCamera.cpp b/samplecode/SampleCamera.cpp
index b860917..ed6cc52 100644
--- a/samplecode/SampleCamera.cpp
+++ b/samplecode/SampleCamera.cpp
@@ -5,6 +5,7 @@
  * found in the LICENSE file.
  */
 
+#include "DecodeFile.h"
 #include "SampleCode.h"
 #include "SkAnimTimer.h"
 #include "SkView.h"
@@ -17,7 +18,6 @@
 #include "SkShader.h"
 #include "SkUtils.h"
 #include "SkRandom.h"
-#include "SkImageDecoder.h"
 
 class CameraView : public SampleView {
     SkTDArray<SkShader*> fShaders;
@@ -33,7 +33,7 @@
             SkString str;
             str.printf("/skimages/elephant%d.jpeg", i);
             SkBitmap bm;
-            if (SkImageDecoder::DecodeFile(str.c_str(), &bm)) {
+            if (decode_file(str.c_str(), &bm)) {
                 SkRect src = { 0, 0, SkIntToScalar(bm.width()), SkIntToScalar(bm.height()) };
                 SkRect dst = { -150, -150, 150, 150 };
                 SkMatrix matrix;
diff --git a/samplecode/SampleConcavePaths.cpp b/samplecode/SampleConcavePaths.cpp
index fb5447e..abdf707 100644
--- a/samplecode/SampleConcavePaths.cpp
+++ b/samplecode/SampleConcavePaths.cpp
@@ -11,7 +11,6 @@
 #include "SkCanvas.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkPath.h"
 #include "SkRegion.h"
 #include "SkShader.h"
diff --git a/samplecode/SampleEmboss.cpp b/samplecode/SampleEmboss.cpp
index f219cdd..6e33e05 100644
--- a/samplecode/SampleEmboss.cpp
+++ b/samplecode/SampleEmboss.cpp
@@ -13,7 +13,6 @@
 #include "SkEmbossMaskFilter.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkPath.h"
 #include "SkRandom.h"
 #include "SkRegion.h"
diff --git a/samplecode/SampleFilter2.cpp b/samplecode/SampleFilter2.cpp
index 3663f11..8c93563 100644
--- a/samplecode/SampleFilter2.cpp
+++ b/samplecode/SampleFilter2.cpp
@@ -5,12 +5,12 @@
  * found in the LICENSE file.
  */
 
+#include "DecodeFile.h"
 #include "SampleCode.h"
 #include "SkView.h"
 #include "SkCanvas.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkPath.h"
 #include "SkRegion.h"
 #include "SkShader.h"
@@ -35,12 +35,10 @@
         fBitmaps = new SkBitmap[fBitmapCount];
 
         for (int i = 0; i < fBitmapCount/2; i++) {
-            SkImageDecoder::DecodeFile(gNames[i], &fBitmaps[i], kN32_SkColorType,
-                                       SkImageDecoder::kDecodePixels_Mode, nullptr);
+            decode_file(gNames[i], &fBitmaps[i]);
         }
         for (int i = fBitmapCount/2; i < fBitmapCount; i++) {
-            SkImageDecoder::DecodeFile(gNames[i-fBitmapCount/2], &fBitmaps[i], kRGB_565_SkColorType,
-                                       SkImageDecoder::kDecodePixels_Mode, nullptr);
+            decode_file(gNames[i-fBitmapCount/2], &fBitmaps[i], kRGB_565_SkColorType);
         }
         fCurrIndex = 0;
 
diff --git a/samplecode/SampleHairline.cpp b/samplecode/SampleHairline.cpp
index 7471533..fef44f5 100644
--- a/samplecode/SampleHairline.cpp
+++ b/samplecode/SampleHairline.cpp
@@ -12,7 +12,6 @@
 #include "SkCornerPathEffect.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkPath.h"
 #include "SkRandom.h"
 #include "SkRegion.h"
@@ -26,7 +25,6 @@
 
 #include "SkStream.h"
 #include "SkColorPriv.h"
-#include "SkImageDecoder.h"
 
 static SkRandom gRand;
 
diff --git a/samplecode/SampleIdentityScale.cpp b/samplecode/SampleIdentityScale.cpp
index 5a4e39d..b6af3ce 100644
--- a/samplecode/SampleIdentityScale.cpp
+++ b/samplecode/SampleIdentityScale.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 "SkPath.h"
 #include "SkRandom.h"
 #include "SkStream.h"
@@ -25,16 +25,7 @@
 public:
     IdentityScaleView(const char imageFilename[]) {
       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
       }
diff --git a/samplecode/SampleLayers.cpp b/samplecode/SampleLayers.cpp
index 1183568..b31c839 100644
--- a/samplecode/SampleLayers.cpp
+++ b/samplecode/SampleLayers.cpp
@@ -14,7 +14,7 @@
 #include "SkColorPriv.h"
 #include "SkDevice.h"
 #include "SkGradientShader.h"
-#include "SkImageDecoder.h"
+#include "SkImage.h"
 #include "SkInterpolator.h"
 #include "SkMaskFilter.h"
 #include "SkPath.h"
diff --git a/samplecode/SampleLighting.cpp b/samplecode/SampleLighting.cpp
index 566ed7f..fa88e3e 100755
--- a/samplecode/SampleLighting.cpp
+++ b/samplecode/SampleLighting.cpp
@@ -5,11 +5,11 @@
  * Use of this source code is governed by a BSD-style license that can be
  * found in the LICENSE file.
  */
+#include "DecodeFile.h"
 #include "SampleCode.h"
 #include "Resources.h"
 
 #include "SkCanvas.h"
-#include "SkImageDecoder.h"
 #include "SkLightingShader.h"
 #include "SkPoint3.h"
 
@@ -39,9 +39,9 @@
 
     LightingView() {
         SkString diffusePath = GetResourcePath("brickwork-texture.jpg");
-        SkImageDecoder::DecodeFile(diffusePath.c_str(), &fDiffuseBitmap);
+        decode_file(diffusePath.c_str(), &fDiffuseBitmap);
         SkString normalPath = GetResourcePath("brickwork_normal-map.jpg");
-        SkImageDecoder::DecodeFile(normalPath.c_str(), &fNormalBitmap);
+        decode_file(normalPath.c_str(), &fNormalBitmap);
 
         fLightAngle = 0.0f;
         fColorFactor = 0.0f;
diff --git a/samplecode/SampleLines.cpp b/samplecode/SampleLines.cpp
index da5fa57..08a9e86 100644
--- a/samplecode/SampleLines.cpp
+++ b/samplecode/SampleLines.cpp
@@ -5,13 +5,13 @@
  * found in the LICENSE file.
  */
 
+#include "DecodeFile.h"
 #include "SampleCode.h"
 #include "SkView.h"
 #include "SkCanvas.h"
 #include "SkCornerPathEffect.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkPath.h"
 #include "SkRandom.h"
 #include "SkRegion.h"
@@ -25,7 +25,6 @@
 
 #include "SkStream.h"
 #include "SkColorPriv.h"
-#include "SkImageDecoder.h"
 
 class LinesView : public SampleView {
 public:
@@ -63,7 +62,7 @@
 
     void onDrawContent(SkCanvas* canvas) override {
         SkBitmap bm;
-        SkImageDecoder::DecodeFile("/kill.gif", &bm);
+        decode_file("/kill.gif", &bm);
         canvas->drawBitmap(bm, 0, 0, nullptr);
 
         this->drawRings(canvas);
diff --git a/samplecode/SamplePatch.cpp b/samplecode/SamplePatch.cpp
index 3ce350a..641e1e9 100644
--- a/samplecode/SamplePatch.cpp
+++ b/samplecode/SamplePatch.cpp
@@ -5,13 +5,13 @@
  * found in the LICENSE file.
  */
 
+#include "DecodeFile.h"
 #include "SampleCode.h"
 #include "SkAnimTimer.h"
 #include "SkView.h"
 #include "SkCanvas.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkPath.h"
 #include "SkRandom.h"
 #include "SkRegion.h"
@@ -31,8 +31,8 @@
 static sk_sp<SkShader> make_shader0(SkIPoint* size) {
     SkBitmap    bm;
 
-//    SkImageDecoder::DecodeFile("/skimages/progressivejpg.jpg", &bm);
-    SkImageDecoder::DecodeFile("/skimages/logo.png", &bm);
+//    decode_file("/skimages/progressivejpg.jpg", &bm);
+    decode_file("/skimages/logo.png", &bm);
     size->set(bm.width(), bm.height());
     return SkShader::MakeBitmapShader(bm, SkShader::kClamp_TileMode,
                                        SkShader::kClamp_TileMode);
diff --git a/samplecode/SamplePath.cpp b/samplecode/SamplePath.cpp
index 9ef1c85..fec3b5e 100644
--- a/samplecode/SamplePath.cpp
+++ b/samplecode/SamplePath.cpp
@@ -12,7 +12,6 @@
 #include "SkCanvas.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkPath.h"
 #include "SkRegion.h"
 #include "SkShader.h"
diff --git a/samplecode/SamplePathClip.cpp b/samplecode/SamplePathClip.cpp
index 09f1c97..02a613a 100644
--- a/samplecode/SamplePathClip.cpp
+++ b/samplecode/SamplePathClip.cpp
@@ -10,7 +10,6 @@
 #include "SkCanvas.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkPath.h"
 #include "SkRegion.h"
 #include "SkShader.h"
diff --git a/samplecode/SamplePdfFileViewer.cpp b/samplecode/SamplePdfFileViewer.cpp
index 950d42b..a36b29f 100644
--- a/samplecode/SamplePdfFileViewer.cpp
+++ b/samplecode/SamplePdfFileViewer.cpp
@@ -15,7 +15,6 @@
 #include "SkCanvas.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkOSFile.h"
 #include "SkPath.h"
 #include "SkPicture.h"
diff --git a/samplecode/SamplePictFile.cpp b/samplecode/SamplePictFile.cpp
index b456aef..c1958c8 100644
--- a/samplecode/SamplePictFile.cpp
+++ b/samplecode/SamplePictFile.cpp
@@ -5,13 +5,13 @@
  * found in the LICENSE file.
  */
 
+#include "DecodeFile.h"
 #include "SampleCode.h"
 #include "SkDumpCanvas.h"
 #include "SkView.h"
 #include "SkCanvas.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkOSFile.h"
 #include "SkPath.h"
 #include "SkPicture.h"
@@ -153,7 +153,7 @@
         sk_sp<SkPicture> pic;
 
         SkBitmap bm;
-        if (SkImageDecoder::DecodeFile(path, &bm)) {
+        if (decode_file(path, &bm)) {
             bm.setImmutable();
             SkPictureRecorder recorder;
             SkCanvas* can = recorder.beginRecording(SkIntToScalar(bm.width()),
diff --git a/samplecode/SamplePoints.cpp b/samplecode/SamplePoints.cpp
index 6b3f82d..0bfe28f 100644
--- a/samplecode/SamplePoints.cpp
+++ b/samplecode/SamplePoints.cpp
@@ -10,7 +10,6 @@
 #include "SkCanvas.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkPath.h"
 #include "SkRandom.h"
 #include "SkRegion.h"
diff --git a/samplecode/SampleRegion.cpp b/samplecode/SampleRegion.cpp
index 639203b..1934dc7 100644
--- a/samplecode/SampleRegion.cpp
+++ b/samplecode/SampleRegion.cpp
@@ -13,7 +13,6 @@
 #include "SkRegion.h"
 #include "SkShader.h"
 #include "SkUtils.h"
-#include "SkImageDecoder.h"
 
 #include <math.h>
 
diff --git a/samplecode/SampleShaders.cpp b/samplecode/SampleShaders.cpp
index 71ddc2e..2ea6f0a 100644
--- a/samplecode/SampleShaders.cpp
+++ b/samplecode/SampleShaders.cpp
@@ -5,12 +5,12 @@
  * found in the LICENSE file.
  */
 
+#include "DecodeFile.h"
 #include "SampleCode.h"
 #include "SkView.h"
 #include "SkCanvas.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkPath.h"
 #include "SkRegion.h"
 #include "SkShader.h"
@@ -45,7 +45,7 @@
     SkBitmap        fBitmap;
 
     ShaderView() {
-        SkImageDecoder::DecodeFile("/skimages/logo.gif", &fBitmap);
+        decode_file("/skimages/logo.gif", &fBitmap);
 
         SkPoint pts[2];
         SkColor colors[2];
diff --git a/samplecode/SampleSlides.cpp b/samplecode/SampleSlides.cpp
index 38fd740..ca0d9df 100644
--- a/samplecode/SampleSlides.cpp
+++ b/samplecode/SampleSlides.cpp
@@ -304,7 +304,7 @@
 
 ///////////////////////////////////////////////////////////////////////////////
 
-#include "SkImageDecoder.h"
+#include "DecodeFile.h"
 #include "SkOSFile.h"
 #include "SkRandom.h"
 #include "SkStream.h"
@@ -312,7 +312,7 @@
 static sk_sp<SkShader> make_shader0(SkIPoint* size) {
     SkBitmap    bm;
 
-    SkImageDecoder::DecodeFile("/skimages/logo.gif", &bm);
+    decode_file("/skimages/logo.gif", &bm);
     size->set(bm.width(), bm.height());
     return SkShader::MakeBitmapShader(bm, SkShader::kClamp_TileMode,
                                         SkShader::kClamp_TileMode);
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
       }
diff --git a/samplecode/SampleText.cpp b/samplecode/SampleText.cpp
index 239c4da..6dca100 100644
--- a/samplecode/SampleText.cpp
+++ b/samplecode/SampleText.cpp
@@ -12,7 +12,6 @@
 #include "SkWriteBuffer.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkPath.h"
 #include "SkRandom.h"
 #include "SkRegion.h"
diff --git a/samplecode/SampleTextAlpha.cpp b/samplecode/SampleTextAlpha.cpp
index d8fd104..6e2e950 100644
--- a/samplecode/SampleTextAlpha.cpp
+++ b/samplecode/SampleTextAlpha.cpp
@@ -12,7 +12,6 @@
 #include "SkDevice.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkPath.h"
 #include "SkRandom.h"
 #include "SkRegion.h"
diff --git a/samplecode/SampleTextBox.cpp b/samplecode/SampleTextBox.cpp
index 61a18e2..aedeaf6 100644
--- a/samplecode/SampleTextBox.cpp
+++ b/samplecode/SampleTextBox.cpp
@@ -12,7 +12,6 @@
 #include "SkColorShader.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkPath.h"
 #include "SkRandom.h"
 #include "SkRegion.h"
diff --git a/samplecode/SampleUnpremul.cpp b/samplecode/SampleUnpremul.cpp
index 4e3e1fa..fb9735c 100644
--- a/samplecode/SampleUnpremul.cpp
+++ b/samplecode/SampleUnpremul.cpp
@@ -8,14 +8,13 @@
 #include "gm.h"
 
 #include "sk_tool_utils.h"
+#include "DecodeFile.h"
 #include "Resources.h"
 #include "SampleCode.h"
 #include "SkBlurMask.h"
 #include "SkBlurDrawLooper.h"
 #include "SkCanvas.h"
 #include "SkColorPriv.h"
-#include "SkForceLinking.h"
-#include "SkImageDecoder.h"
 #include "SkOSFile.h"
 #include "SkStream.h"
 #include "SkString.h"
@@ -24,8 +23,6 @@
 #include "SkUtils.h"
 #include "SkView.h"
 
-__SK_FORCE_IMAGE_DECODER_LINKING;
-
 /**
  *  Interprets c as an unpremultiplied color, and returns the
  *  premultiplied equivalent.
@@ -167,17 +164,7 @@
             fDecodeSucceeded = false;
             return;
         }
-        SkFILEStream stream(fCurrFile.c_str());
-        SkAutoTDelete<SkImageDecoder> decoder(SkImageDecoder::Factory(&stream));
-        if (nullptr == decoder.get()) {
-            fDecodeSucceeded = false;
-            return;
-        }
-        if (!fPremul) {
-            decoder->setRequireUnpremultipliedColors(true);
-        }
-        fDecodeSucceeded = decoder->decode(&stream, &fBitmap, kN32_SkColorType,
-                SkImageDecoder::kDecodePixels_Mode) != SkImageDecoder::kFailure;
+        fDecodeSucceeded = decode_file(fCurrFile.c_str(), &fBitmap, kN32_SkColorType, !fPremul);
         this->inval(nullptr);
     }
 
diff --git a/samplecode/SampleVertices.cpp b/samplecode/SampleVertices.cpp
index a8dcd22..985ef60 100644
--- a/samplecode/SampleVertices.cpp
+++ b/samplecode/SampleVertices.cpp
@@ -10,7 +10,6 @@
 #include "SkCanvas.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkPath.h"
 #include "SkRandom.h"
 #include "SkRegion.h"
diff --git a/samplecode/SampleXfermodesBlur.cpp b/samplecode/SampleXfermodesBlur.cpp
index 867398d..52419a0 100644
--- a/samplecode/SampleXfermodesBlur.cpp
+++ b/samplecode/SampleXfermodesBlur.cpp
@@ -12,7 +12,6 @@
 #include "SkCornerPathEffect.h"
 #include "SkGradientShader.h"
 #include "SkGraphics.h"
-#include "SkImageDecoder.h"
 #include "SkPath.h"
 #include "SkRandom.h"
 #include "SkRegion.h"
@@ -26,7 +25,6 @@
 
 #include "SkStream.h"
 #include "SkColorPriv.h"
-#include "SkImageDecoder.h"
 #include "SkBlurMaskFilter.h"
 
 static void setNamedTypeface(SkPaint* paint, const char name[]) {