diff options
author | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-27 20:50:52 +0000 |
---|---|---|
committer | sail@chromium.org <sail@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-27 20:50:52 +0000 |
commit | 7b9cf72a104f1237de9d4ee29b81e03516106084 (patch) | |
tree | 1af51fc4d266a2b21c760947d37c8d3498ca2397 /chrome/browser/themes/theme_service_mac.mm | |
parent | e6c61281ca34ea34e8408bd4fd01daf4c8e4c5fd (diff) | |
download | chromium_src-7b9cf72a104f1237de9d4ee29b81e03516106084.zip chromium_src-7b9cf72a104f1237de9d4ee29b81e03516106084.tar.gz chromium_src-7b9cf72a104f1237de9d4ee29b81e03516106084.tar.bz2 |
Use large icon resource pak
This is part of change r82185 that was reverted due to a performance regression on 10.5.
The performance regression was due to a change in skia_utils_mac.mm to draw images using -[NSImageRep drawRect:] instead of -[NSImage drawRect:...].
It turns out that on 10.5 -[NSImage drawRect:...] does caching that imporoves performance for subsequent drawing by as much as 4x.
This change is similar to r82185 expect that we now use -[NSImage drawRect:] if available.
BUG=75812
TEST=Ran unit tests locally, try jobs pending.
Review URL: http://codereview.chromium.org/6905003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83206 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/themes/theme_service_mac.mm')
-rw-r--r-- | chrome/browser/themes/theme_service_mac.mm | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/chrome/browser/themes/theme_service_mac.mm b/chrome/browser/themes/theme_service_mac.mm index 30d359e..73fd814 100644 --- a/chrome/browser/themes/theme_service_mac.mm +++ b/chrome/browser/themes/theme_service_mac.mm @@ -10,7 +10,9 @@ #include "chrome/browser/themes/browser_theme_pack.h" #include "skia/ext/skia_utils_mac.h" #import "third_party/GTM/AppKit/GTMNSColor+Luminance.h" +#include "ui/base/resource/resource_bundle.h" #include "ui/gfx/color_utils.h" +#include "ui/gfx/image.h" NSString* const kBrowserThemeDidChangeNotification = @"BrowserThemeDidChangeNotification"; @@ -44,8 +46,18 @@ NSImage* ThemeService::GetNSImageNamed(int id, bool allow_default) const { // SkBitmap > native conversion? // - For consistency with other platforms. // - To get the generated tinted images. - SkBitmap* bitmap = GetBitmapNamed(id); - NSImage* nsimage = gfx::SkBitmapToNSImage(*bitmap); + NSImage* nsimage = nil; + if (theme_pack_.get()) { + SkBitmap* bitmap = theme_pack_->GetBitmapNamed(id); + if (bitmap) + nsimage = gfx::SkBitmapToNSImage(*bitmap); + } + + // If the theme didn't override this image then load it from the resource + // bundle. + if (!nsimage) { + nsimage = rb_.GetNativeImageNamed(id); + } // We loaded successfully. Cache the image. if (nsimage) { |