Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: ui/base/resource/resource_bundle.cc

Issue 8970032: Changing Aura background for new temporary one. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adressed comment Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/aura_shell/desktop_background_view.cc ('k') | ui/resources/aura/damask.png » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..66b3cf51000169b01271ece565941218b8a47bdf 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 =
+ 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() {
« no previous file with comments | « ui/aura_shell/desktop_background_view.cc ('k') | ui/resources/aura/damask.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698