diff options
author | saintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-02 17:13:28 +0000 |
---|---|---|
committer | saintlou@chromium.org <saintlou@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-03-02 17:13:28 +0000 |
commit | 2151205d3a847b81b92352648d0f34c12874d4c0 (patch) | |
tree | 26512f86f2179765f11d7aa08f2c59e79157229b | |
parent | 66dfcf570d6464178d7627d1a0d3f4b42faa14bb (diff) | |
download | chromium_src-2151205d3a847b81b92352648d0f34c12874d4c0.zip chromium_src-2151205d3a847b81b92352648d0f34c12874d4c0.tar.gz chromium_src-2151205d3a847b81b92352648d0f34c12874d4c0.tar.bz2 |
Switching back the backgroung to JPG.
After this is landed I will remove ui/resources/aura/wallpaper.png in CL 9566044.
BUG=105508
TEST=none
Review URL: https://chromiumcodereview.appspot.com/9567037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@124670 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | ash/desktop_background/desktop_background_view.cc | 5 | ||||
-rw-r--r-- | ui/base/resource/resource_bundle.cc | 16 | ||||
-rw-r--r-- | ui/resources/ui_resources.grd | 21 |
3 files changed, 32 insertions, 10 deletions
diff --git a/ash/desktop_background/desktop_background_view.cc b/ash/desktop_background/desktop_background_view.cc index 79470f0..dbf256f 100644 --- a/ash/desktop_background/desktop_background_view.cc +++ b/ash/desktop_background/desktop_background_view.cc @@ -30,7 +30,7 @@ static int RoundPositive(double x) { DesktopBackgroundView::DesktopBackgroundView() { wallpaper_ = *ui::ResourceBundle::GetSharedInstance().GetImageNamed( - IDR_AURA_WALLPAPER).ToSkBitmap(); + IDR_AURA_WALLPAPER_1).ToSkBitmap(); wallpaper_.buildMipMap(false); } @@ -71,8 +71,7 @@ void DesktopBackgroundView::OnPaint(gfx::Canvas* canvas) { wallpaper_cropped_rect.width(), wallpaper_cropped_rect.height(), 0, 0, width(), height(), true); - } - else { + } else { // Center the wallpaper in the destination rectangle (Skia will crop // as needed). We might decide later to tile small solid color images. canvas->DrawBitmapInt(wallpaper_, (width() - wallpaper_.width()) / 2, diff --git a/ui/base/resource/resource_bundle.cc b/ui/base/resource/resource_bundle.cc index 197002e..d0ad99f 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" @@ -349,12 +350,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() { diff --git a/ui/resources/ui_resources.grd b/ui/resources/ui_resources.grd index b6ffef3..7e59c1e 100644 --- a/ui/resources/ui_resources.grd +++ b/ui/resources/ui_resources.grd @@ -178,10 +178,27 @@ <include name="IDR_AURA_SHADOW_SMALL_BOTTOM" file="aura/small_shadow_bottom.png" type="BINDATA" /> <include name="IDR_AURA_SHADOW_SMALL_BOTTOM_RIGHT" file="aura/small_shadow_bottom_right.png" type="BINDATA" /> <include name="IDR_AURA_STATUS_MOCK" file="aura/statusbar.png" type="BINDATA" /> - <include name="IDR_AURA_WALLPAPER" file="aura/wallpaper.png" type="BINDATA" /> - <include name="IDR_AURA_WINDOW_CLOSE_ICON" file="aura/slab_close.png" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_1" file="aura/wallpaper_1.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_1_THUMB" file="aura/wallpaper_1_thumb.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_2" file="aura/wallpaper_2.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_2_THUMB" file="aura/wallpaper_2_thumb.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_3" file="aura/wallpaper_3.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_3_THUMB" file="aura/wallpaper_3_thumb.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_4" file="aura/wallpaper_4.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_4_THUMB" file="aura/wallpaper_4_thumb.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_5" file="aura/wallpaper_5.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_5_THUMB" file="aura/wallpaper_5_thumb.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_6" file="aura/wallpaper_6.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_6_THUMB" file="aura/wallpaper_6_thumb.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_7" file="aura/wallpaper_7.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_7_THUMB" file="aura/wallpaper_7_thumb.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_8" file="aura/wallpaper_8.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_8_THUMB" file="aura/wallpaper_8_thumb.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_9" file="aura/wallpaper_9.jpg" type="BINDATA" /> + <include name="IDR_AURA_WALLPAPER_9_THUMB" file="aura/wallpaper_9_thumb.jpg" type="BINDATA" /> <include name="IDR_AURA_WINDOW_BOTTOM_LEFT" file="aura/window_bottom_left.png" type="BINDATA" /> <include name="IDR_AURA_WINDOW_BOTTOM_RIGHT" file="aura/window_bottom_right.png" type="BINDATA" /> + <include name="IDR_AURA_WINDOW_CLOSE_ICON" file="aura/slab_close.png" type="BINDATA" /> <include name="IDR_AURA_WINDOW_FULLSCREEN_CLOSE" file="aura/window_fullscreen_close.png" type="BINDATA" /> <include name="IDR_AURA_WINDOW_FULLSCREEN_RESTORE" file="aura/window_fullscreen_restore.png" type="BINDATA" /> <include name="IDR_AURA_WINDOW_FULLSCREEN_SEPARATOR" file="aura/window_fullscreen_separator.png" type="BINDATA" /> |