Get rid of SkImage_Codec

Use SkImage_Raster with an ImageGenerator instead.

BUG=skia:2948
R=junov@chromium.org, reed@google.com, bsalomon@chromium.org

Author: piotaixr@chromium.org

Review URL: https://codereview.chromium.org/589713002
diff --git a/gyp/core.gypi b/gyp/core.gypi
index c05fa48..71d812b 100644
--- a/gyp/core.gypi
+++ b/gyp/core.gypi
@@ -219,7 +219,6 @@
 
         '<(skia_src_path)/image/SkImage.cpp',
         '<(skia_src_path)/image/SkImagePriv.cpp',
-        '<(skia_src_path)/image/SkImage_Codec.cpp',
 #        '<(skia_src_path)/image/SkImage_Gpu.cpp',
         '<(skia_src_path)/image/SkImage_Raster.cpp',
         '<(skia_src_path)/image/SkSurface.cpp',
diff --git a/include/core/SkImage.h b/include/core/SkImage.h
index 1f27514..a723aee 100644
--- a/include/core/SkImage.h
+++ b/include/core/SkImage.h
@@ -39,7 +39,6 @@
 
     static SkImage* NewRasterCopy(const Info&, const void* pixels, size_t rowBytes);
     static SkImage* NewRasterData(const Info&, SkData* pixels, size_t rowBytes);
-    static SkImage* NewEncodedData(SkData*);
 
     /**
      * GrTexture is a more logical parameter for this factory, but its
diff --git a/src/image/SkImage_Codec.cpp b/src/image/SkImage_Codec.cpp
deleted file mode 100644
index 4e00e26..0000000
--- a/src/image/SkImage_Codec.cpp
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright 2012 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "SkImageDecoder.h"
-#include "SkImage_Base.h"
-#include "SkBitmap.h"
-#include "SkCanvas.h"
-#include "SkData.h"
-
-class SkImage_Codec : public SkImage_Base {
-public:
-    static SkImage* NewEmpty();
-
-    SkImage_Codec(SkData* encodedData, int width, int height);
-    virtual ~SkImage_Codec();
-
-    virtual void onDraw(SkCanvas*, SkScalar, SkScalar, const SkPaint*) const SK_OVERRIDE;
-    virtual void onDrawRectToRect(SkCanvas*, const SkRect*, const SkRect&,
-                                  const SkPaint*) const SK_OVERRIDE;
-
-    virtual bool isOpaque() const SK_OVERRIDE;
-
-private:
-    bool ensureBitmapDecoded() const;
-
-    SkData*     fEncodedData;
-    SkBitmap    fBitmap;
-
-    typedef SkImage_Base INHERITED;
-};
-
-///////////////////////////////////////////////////////////////////////////////
-
-SkImage_Codec::SkImage_Codec(SkData* data, int width, int height) : INHERITED(width, height) {
-    fEncodedData = data;
-    fEncodedData->ref();
-}
-
-SkImage_Codec::~SkImage_Codec() {
-    fEncodedData->unref();
-}
-
-bool SkImage_Codec::ensureBitmapDecoded() const {
-    if (!fBitmap.pixelRef()) {
-        // todo: this needs to be thread-safe
-        SkBitmap* bitmap = const_cast<SkBitmap*>(&fBitmap);
-        if (!SkImageDecoder::DecodeMemory(fEncodedData->bytes(), fEncodedData->size(), bitmap)) {
-            return false;
-        }
-    }
-    return true;
-}
-
-void SkImage_Codec::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const {
-    if(!this->ensureBitmapDecoded()) {
-        return;
-    }
-
-    canvas->drawBitmap(fBitmap, x, y, paint);
-}
-
-void SkImage_Codec::onDrawRectToRect(SkCanvas* canvas, const SkRect* src, const SkRect& dst,
-                                     const SkPaint* paint) const {
-    if(!this->ensureBitmapDecoded()) {
-        return;
-    }
-
-    canvas->drawBitmapRectToRect(fBitmap, src, dst, paint);
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-SkImage* SkImage::NewEncodedData(SkData* data) {
-    if (NULL == data) {
-        return NULL;
-    }
-
-    SkBitmap bitmap;
-    if (!SkImageDecoder::DecodeMemory(data->bytes(), data->size(), &bitmap, kUnknown_SkColorType,
-                                      SkImageDecoder::kDecodeBounds_Mode)) {
-        return NULL;
-    }
-
-    return SkNEW_ARGS(SkImage_Codec, (data, bitmap.width(), bitmap.height()));
-}
-
-
-bool SkImage_Codec::isOpaque() const {
-    return fBitmap.isOpaque();
-}