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

Side by Side Diff: base/mac_util.h

Issue 3072005: Move NSImage-to-CGImageRef conversion code into a common helper function in base/mac_util.h. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Fix test Created 10 years, 4 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 | « no previous file | base/mac_util.mm » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #ifndef BASE_MAC_UTIL_H_ 5 #ifndef BASE_MAC_UTIL_H_
6 #define BASE_MAC_UTIL_H_ 6 #define BASE_MAC_UTIL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <Carbon/Carbon.h> 9 #include <Carbon/Carbon.h>
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 class FilePath; 13 class FilePath;
14 14
15 #ifdef __OBJC__ 15 #ifdef __OBJC__
16 @class NSBundle; 16 @class NSBundle;
17 @class NSWindow; 17 @class NSWindow;
18 #else 18 #else
19 class NSBundle; 19 class NSBundle;
20 class NSImage;
20 class NSWindow; 21 class NSWindow;
21 #endif 22 #endif
22 23
23 // Adapted from NSPathUtilities.h and NSObjCRuntime.h. 24 // Adapted from NSPathUtilities.h and NSObjCRuntime.h.
24 #if __LP64__ || NS_BUILD_32_LIKE_64 25 #if __LP64__ || NS_BUILD_32_LIKE_64
25 typedef unsigned long NSSearchPathDirectory; 26 typedef unsigned long NSSearchPathDirectory;
26 #else 27 #else
27 typedef unsigned int NSSearchPathDirectory; 28 typedef unsigned int NSSearchPathDirectory;
28 #endif 29 #endif
29 30
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 135
135 // Utility function to pull out a value from a dictionary, check its type, and 136 // Utility function to pull out a value from a dictionary, check its type, and
136 // return it. Returns NULL if the key is not present or of the wrong type. 137 // return it. Returns NULL if the key is not present or of the wrong type.
137 CFTypeRef GetValueFromDictionary(CFDictionaryRef dict, 138 CFTypeRef GetValueFromDictionary(CFDictionaryRef dict,
138 CFStringRef key, 139 CFStringRef key,
139 CFTypeID expected_type); 140 CFTypeID expected_type);
140 141
141 // Sets the process name as displayed in Activity Monitor to process_name. 142 // Sets the process name as displayed in Activity Monitor to process_name.
142 void SetProcessName(CFStringRef process_name); 143 void SetProcessName(CFStringRef process_name);
143 144
145 // Converts a NSImage to a CGImageRef. Normally, the system frameworks can do
146 // this fine, especially on 10.6. On 10.5, however, CGImage cannot handle
147 // converting a PDF-backed NSImage into a CGImageRef. This function will
148 // rasterize the PDF into a bitmap CGImage. The caller is responsible for
149 // releasing the return value.
150 CGImageRef CopyNSImageToCGImage(NSImage* image);
151
144 } // namespace mac_util 152 } // namespace mac_util
145 153
146 #endif // BASE_MAC_UTIL_H_ 154 #endif // BASE_MAC_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | base/mac_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698