Chromium Code Reviews| Index: ui/base/resource/resource_bundle.cc |
| diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc |
| index 1b3e293687b57c06dcbfb9c9a007d2cbd3977892..73d2cdc5fac56621031265ba22ae8a3a16283b16 100644 |
| --- a/ui/base/resource/resource_bundle.cc |
| +++ b/ui/base/resource/resource_bundle.cc |
| @@ -19,6 +19,7 @@ |
| #include "ui/base/resource/data_pack.h" |
| #include "ui/base/ui_base_paths.h" |
| #include "ui/base/ui_base_switches.h" |
| +#include "ui/gfx/codec/jpeg_codec.h" |
| #include "ui/gfx/codec/png_codec.h" |
| #include "ui/gfx/font.h" |
| #include "ui/gfx/image/image.h" |
| @@ -369,12 +370,17 @@ SkBitmap* ResourceBundle::LoadBitmap(DataHandle data_handle, int resource_id) { |
| return NULL; |
| SkBitmap bitmap; |
| - if (!gfx::PNGCodec::Decode(memory->front(), memory->size(), &bitmap)) { |
| - NOTREACHED() << "Unable to decode theme image resource " << resource_id; |
| - return NULL; |
| - } |
| + if (gfx::PNGCodec::Decode(memory->front(), memory->size(), &bitmap)) |
| + return new SkBitmap(bitmap); |
| + |
| + // 99% of our assets are PNGs, however fallback to JPEG. |
| + SkBitmap *allocated_bitmap = |
|
sky
2011/12/16 19:27:23
'SkBitmap *' -> 'SkBitmap* '
Emmanuel Saint-loubert-Bié
2011/12/16 21:43:39
Done.
|
| + gfx::JPEGCodec::Decode(memory->front(), memory->size()); |
| + if (allocated_bitmap) |
| + return allocated_bitmap; |
| - return new SkBitmap(bitmap); |
| + NOTREACHED() << "Unable to decode theme image resource " << resource_id; |
| + return NULL; |
| } |
| gfx::Image* ResourceBundle::GetEmptyImage() { |