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

Side by Side Diff: ui/base/resource/resource_bundle_mac.mm

Issue 6541031: Integrate gfx::Image into the ResourceBundle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 10 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 | Annotate | Revision Log
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 "ui/base/resource/resource_bundle.h" 5 #include "ui/base/resource/resource_bundle.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 mac_locale = [mac_locale stringByReplacingOccurrencesOfString:@"-" 51 mac_locale = [mac_locale stringByReplacingOccurrencesOfString:@"-"
52 withString:@"_"]; 52 withString:@"_"];
53 53
54 // On disk, the "en_US" resources are just "en" (http://crbug.com/25578). 54 // On disk, the "en_US" resources are just "en" (http://crbug.com/25578).
55 if ([mac_locale isEqual:@"en_US"]) 55 if ([mac_locale isEqual:@"en_US"])
56 mac_locale = @"en"; 56 mac_locale = @"en";
57 57
58 return GetResourcesPakFilePath(@"locale", mac_locale); 58 return GetResourcesPakFilePath(@"locale", mac_locale);
59 } 59 }
60 60
61 NSImage* ResourceBundle::GetNSImageNamed(int resource_id) { 61 gfx::Image& ResourceBundle::GetNativeImageNamed(int resource_id) {
62 // Currently this doesn't make a cache holding these as NSImages because 62 // Currently this just returns the Skia-backed image, which will convert to
63 // GetBitmapNamed has a cache, and we don't want to double cache. 63 // NSImage and cache that result when necessary.
64 SkBitmap* bitmap = GetBitmapNamed(resource_id); 64 // TODO(rsesek): Load the raw bytes directly into an NSImage instead.
65 if (!bitmap) 65 return GetImageNamed(resource_id);
66 return nil;
67
68 NSImage* nsimage = gfx::SkBitmapToNSImage(*bitmap);
69 return nsimage;
70 } 66 }
71 67
72 } // namespace ui 68 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698