| Index: ui/gfx/image/image_util.cc
|
| diff --git a/ui/gfx/image/image_util.cc b/ui/gfx/image/image_util.cc
|
| index 04cffca50865c186a81d05f0c025128d2b4c9164..61a77502bbdf0de1b5d7c6d83c7689be25a08761 100644
|
| --- a/ui/gfx/image/image_util.cc
|
| +++ b/ui/gfx/image/image_util.cc
|
| @@ -7,17 +7,18 @@
|
| #include "base/memory/scoped_ptr.h"
|
| #include "third_party/skia/include/core/SkBitmap.h"
|
| #include "ui/gfx/codec/jpeg_codec.h"
|
| -#include "ui/gfx/codec/png_codec.h"
|
| #include "ui/gfx/image/image.h"
|
| +#include "ui/gfx/image/image_skia.h"
|
|
|
| namespace gfx {
|
|
|
| Image* ImageFromPNGEncodedData(const unsigned char* input, size_t input_size) {
|
| - SkBitmap bitmap;
|
| - if (gfx::PNGCodec::Decode(input, input_size, &bitmap))
|
| - return new Image(bitmap);
|
| -
|
| - return NULL;
|
| + Image* image = new Image(input, input_size);
|
| + // Check if image can be converted to an ImageSkia and return NULL if
|
| + // conversion fails.
|
| + if (image->ToImageSkia()->empty())
|
| + return NULL;
|
| + return image;
|
| }
|
|
|
| Image ImageFromJPEGEncodedData(const unsigned char* input, size_t input_size) {
|
| @@ -30,8 +31,8 @@ Image ImageFromJPEGEncodedData(const unsigned char* input, size_t input_size) {
|
|
|
| bool PNGEncodedDataFromImage(const Image& image,
|
| std::vector<unsigned char>* dst) {
|
| - const SkBitmap& bitmap = *image.ToSkBitmap();
|
| - return gfx::PNGCodec::EncodeBGRASkBitmap(bitmap, false, dst);
|
| + *dst = *image.ToImagePNG();
|
| + return !dst->empty();
|
| }
|
|
|
| bool JPEGEncodedDataFromImage(const Image& image, int quality,
|
|
|