| Index: chrome/browser/cocoa/animatable_image.mm
|
| diff --git a/chrome/browser/cocoa/animatable_image.mm b/chrome/browser/cocoa/animatable_image.mm
|
| index db0822417ab6ad117894374fc57a4ac975455bc4..06014c29067ca5b936fa04d2ad4a8d05ab646db2 100644
|
| --- a/chrome/browser/cocoa/animatable_image.mm
|
| +++ b/chrome/browser/cocoa/animatable_image.mm
|
| @@ -5,6 +5,7 @@
|
| #import "chrome/browser/cocoa/animatable_image.h"
|
|
|
| #include "base/logging.h"
|
| +#import "base/mac_util.h"
|
| #include "base/scoped_cftyperef.h"
|
| #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h"
|
|
|
| @@ -131,31 +132,10 @@
|
| // image into a bitmap CGImageRef. This is based loosely on
|
| // http://www.cocoadev.com/index.pl?CGImageRef.
|
| - (void)setLayerContents:(CALayer*)layer {
|
| - NSSize size = [image_ size];
|
| - 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);
|
| -
|
| - [NSGraphicsContext saveGraphicsState];
|
| - [NSGraphicsContext setCurrentContext:
|
| - [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO]];
|
| - [image_ drawInRect:NSMakeRect(0,0, size.width, size.height)
|
| - fromRect:NSZeroRect
|
| - operation:NSCompositeCopy
|
| - fraction:1.0];
|
| - [NSGraphicsContext restoreGraphicsState];
|
| -
|
| - scoped_cftyperef<CGImageRef> cgImage(CGBitmapContextCreateImage(context));
|
| - CGContextRelease(context);
|
| -
|
| + scoped_cftyperef<CGImageRef> image(
|
| + mac_util::CopyNSImageToCGImage(image_.get()));
|
| // Create the layer that will be animated.
|
| - [layer setContents:(id)cgImage.get()];
|
| + [layer setContents:(id)image.get()];
|
| }
|
|
|
| // CAAnimation delegate method called when the animation is complete.
|
|
|