diff options
Diffstat (limited to 'app/resource_bundle.cc')
-rw-r--r-- | app/resource_bundle.cc | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/app/resource_bundle.cc b/app/resource_bundle.cc index 7261dfd..28674a8 100644 --- a/app/resource_bundle.cc +++ b/app/resource_bundle.cc @@ -69,27 +69,18 @@ void ResourceBundle::FreeImages() { /* static */ SkBitmap* ResourceBundle::LoadBitmap(DataHandle data_handle, int resource_id) { - std::vector<unsigned char> png_data; - scoped_refptr<RefCountedMemory> memory( LoadResourceBytes(data_handle, resource_id)); if (!memory) return NULL; - // Decode the PNG. - int image_width; - int image_height; - if (!gfx::PNGCodec::Decode( - memory->front(), memory->size(), - gfx::PNGCodec::FORMAT_BGRA, - &png_data, &image_width, &image_height)) { - NOTREACHED() << "Unable to decode image resource " << resource_id; + SkBitmap bitmap; + if (!gfx::PNGCodec::Decode(memory->front(), memory->size(), &bitmap)) { + NOTREACHED() << "Unable to decode theme image resource " << resource_id; return NULL; } - return gfx::PNGCodec::CreateSkBitmapFromBGRAFormat(png_data, - image_width, - image_height); + return new SkBitmap(bitmap); } std::string ResourceBundle::GetDataResource(int resource_id) { |