summaryrefslogtreecommitdiffstats
path: root/base/mac
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-27 02:45:22 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-27 02:45:22 +0000
commit8417576df37611b634489b0cf7d19fa71cf07011 (patch)
tree65fe65902750404e0d85696dd4693dca4ae4472c /base/mac
parentfabc951e1d27f3b67912e4799d62caff3c0182a5 (diff)
downloadchromium_src-8417576df37611b634489b0cf7d19fa71cf07011.zip
chromium_src-8417576df37611b634489b0cf7d19fa71cf07011.tar.gz
chromium_src-8417576df37611b634489b0cf7d19fa71cf07011.tar.bz2
Remove helper function that was needed only in 10.5.
The contents of a CALayer can be set to an NSImage* as of 10.6. BUG=none TEST=no changes in download started animation or in tabpose Review URL: https://codereview.chromium.org/45893002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231238 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac')
-rw-r--r--base/mac/mac_util.h7
-rw-r--r--base/mac/mac_util.mm33
-rw-r--r--base/mac/mac_util_unittest.mm14
3 files changed, 0 insertions, 54 deletions
diff --git a/base/mac/mac_util.h b/base/mac/mac_util.h
index cb7ed7e..e827f37 100644
--- a/base/mac/mac_util.h
+++ b/base/mac/mac_util.h
@@ -92,13 +92,6 @@ BASE_EXPORT bool AmIForeground();
// Excludes the file given by |file_path| from being backed up by Time Machine.
BASE_EXPORT bool SetFileBackupExclusion(const FilePath& file_path);
-// Converts a NSImage to a CGImageRef. Normally, the system frameworks can do
-// this fine, especially on 10.6. On 10.5, however, CGImage cannot handle
-// converting a PDF-backed NSImage into a CGImageRef. This function will
-// rasterize the PDF into a bitmap CGImage. The caller is responsible for
-// releasing the return value.
-BASE_EXPORT CGImageRef CopyNSImageToCGImage(NSImage* image);
-
// Checks if the current application is set as a Login Item, so it will launch
// on Login. If a non-NULL pointer to is_hidden is passed, the Login Item also
// is queried for the 'hide on launch' flag.
diff --git a/base/mac/mac_util.mm b/base/mac/mac_util.mm
index dad1d85..c256599 100644
--- a/base/mac/mac_util.mm
+++ b/base/mac/mac_util.mm
@@ -298,39 +298,6 @@ bool SetFileBackupExclusion(const FilePath& file_path) {
return os_err == noErr;
}
-// Converts a NSImage to a CGImageRef. Normally, the system frameworks can do
-// this fine, especially on 10.6. On 10.5, however, CGImage cannot handle
-// converting a PDF-backed NSImage into a CGImageRef. This function will
-// rasterize the PDF into a bitmap CGImage. The caller is responsible for
-// releasing the return value.
-CGImageRef CopyNSImageToCGImage(NSImage* image) {
- // This is based loosely on http://www.cocoadev.com/index.pl?CGImageRef .
- NSSize size = [image size];
- ScopedCFTypeRef<CGContextRef> context(
- CGBitmapContextCreate(NULL, // Allow CG to allocate memory.
- size.width,
- size.height,
- 8, // bitsPerComponent
- 0, // bytesPerRow - CG will calculate by default.
- [[NSColorSpace genericRGBColorSpace] CGColorSpace],
- kCGBitmapByteOrder32Host |
- kCGImageAlphaPremultipliedFirst));
- if (!context.get())
- return NULL;
-
- [NSGraphicsContext saveGraphicsState];
- [NSGraphicsContext setCurrentContext:
- [NSGraphicsContext graphicsContextWithGraphicsPort:context.get()
- flipped:NO]];
- [image drawInRect:NSMakeRect(0,0, size.width, size.height)
- fromRect:NSZeroRect
- operation:NSCompositeCopy
- fraction:1.0];
- [NSGraphicsContext restoreGraphicsState];
-
- return CGBitmapContextCreateImage(context);
-}
-
bool CheckLoginItemStatus(bool* is_hidden) {
ScopedCFTypeRef<LSSharedFileListItemRef> item(GetLoginItemForApp());
if (!item.get())
diff --git a/base/mac/mac_util_unittest.mm b/base/mac/mac_util_unittest.mm
index 0688b5a..15ceca3 100644
--- a/base/mac/mac_util_unittest.mm
+++ b/base/mac/mac_util_unittest.mm
@@ -124,20 +124,6 @@ TEST_F(MacUtilTest, TestExcludeFileFromBackups) {
EXPECT_FALSE(excluded_by_path);
}
-TEST_F(MacUtilTest, CopyNSImageToCGImage) {
- base::scoped_nsobject<NSImage> nsImage(
- [[NSImage alloc] initWithSize:NSMakeSize(20, 20)]);
- [nsImage lockFocus];
- [[NSColor redColor] set];
- NSRect rect = NSZeroRect;
- rect.size = [nsImage size];
- NSRectFill(rect);
- [nsImage unlockFocus];
-
- ScopedCFTypeRef<CGImageRef> cgImage(CopyNSImageToCGImage(nsImage.get()));
- EXPECT_TRUE(cgImage.get());
-}
-
TEST_F(MacUtilTest, NSObjectRetainRelease) {
base::scoped_nsobject<NSArray> array(
[[NSArray alloc] initWithObjects:@"foo", nil]);