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

Side by Side Diff: chrome/browser/themes/theme_service_mac.mm

Issue 13497002: Crop images from custom themes before storing them into the theme pack (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 8 months 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/themes/theme_service.cc ('k') | chrome/browser/ui/libgtk2ui/gtk2_ui.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/themes/theme_service.h" 5 #include "chrome/browser/themes/theme_service.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "chrome/browser/themes/browser_theme_pack.h" 10 #include "chrome/browser/themes/browser_theme_pack.h"
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 NSImageMap::const_iterator nsimage_iter = nsimage_cache_.find(id); 45 NSImageMap::const_iterator nsimage_iter = nsimage_cache_.find(id);
46 if (nsimage_iter != nsimage_cache_.end()) 46 if (nsimage_iter != nsimage_cache_.end())
47 return nsimage_iter->second; 47 return nsimage_iter->second;
48 48
49 // Why don't we load the file directly into the image instead of the whole 49 // Why don't we load the file directly into the image instead of the whole
50 // gfx::Image > native conversion? 50 // gfx::Image > native conversion?
51 // - For consistency with other platforms. 51 // - For consistency with other platforms.
52 // - To get the generated tinted images. 52 // - To get the generated tinted images.
53 NSImage* nsimage = nil; 53 NSImage* nsimage = nil;
54 if (theme_pack_.get()) { 54 if (theme_pack_.get()) {
55 const gfx::Image* image = theme_pack_->GetImageNamed(id); 55 gfx::Image image = theme_pack_->GetImageNamed(id);
56 if (image) 56 if (!image.IsEmpty())
57 nsimage = image->ToNSImage(); 57 nsimage = image.ToNSImage();
58 } 58 }
59 59
60 // If the theme didn't override this image then load it from the resource 60 // If the theme didn't override this image then load it from the resource
61 // bundle. 61 // bundle.
62 if (!nsimage) { 62 if (!nsimage) {
63 nsimage = rb_.GetNativeImageNamed(id).ToNSImage(); 63 nsimage = rb_.GetNativeImageNamed(id).ToNSImage();
64 } 64 }
65 65
66 // We loaded successfully. Cache the image. 66 // We loaded successfully. Cache the image.
67 if (nsimage) { 67 if (nsimage) {
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 316 }
317 nscolor_cache_.clear(); 317 nscolor_cache_.clear();
318 318
319 // Free gradients. 319 // Free gradients.
320 for (NSGradientMap::iterator i = nsgradient_cache_.begin(); 320 for (NSGradientMap::iterator i = nsgradient_cache_.begin();
321 i != nsgradient_cache_.end(); i++) { 321 i != nsgradient_cache_.end(); i++) {
322 [i->second release]; 322 [i->second release];
323 } 323 }
324 nsgradient_cache_.clear(); 324 nsgradient_cache_.clear();
325 } 325 }
OLDNEW
« no previous file with comments | « chrome/browser/themes/theme_service.cc ('k') | chrome/browser/ui/libgtk2ui/gtk2_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698