| OLD | NEW |
| 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 #import "chrome/browser/cocoa/animatable_image.h" | 5 #import "chrome/browser/cocoa/animatable_image.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/scoped_cftyperef.h" | 8 #include "base/scoped_cftyperef.h" |
| 9 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" | 9 #import "third_party/GTM/AppKit/GTMNSAnimation+Duration.h" |
| 10 | 10 |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 [[NSColorSpace genericRGBColorSpace] CGColorSpace], | 141 [[NSColorSpace genericRGBColorSpace] CGColorSpace], |
| 142 kCGBitmapByteOrder32Host | | 142 kCGBitmapByteOrder32Host | |
| 143 kCGImageAlphaPremultipliedFirst); | 143 kCGImageAlphaPremultipliedFirst); |
| 144 | 144 |
| 145 [NSGraphicsContext saveGraphicsState]; | 145 [NSGraphicsContext saveGraphicsState]; |
| 146 [NSGraphicsContext setCurrentContext: | 146 [NSGraphicsContext setCurrentContext: |
| 147 [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO]]; | 147 [NSGraphicsContext graphicsContextWithGraphicsPort:context flipped:NO]]; |
| 148 [image_ drawInRect:NSMakeRect(0,0, size.width, size.height) | 148 [image_ drawInRect:NSMakeRect(0,0, size.width, size.height) |
| 149 fromRect:NSZeroRect | 149 fromRect:NSZeroRect |
| 150 operation:NSCompositeCopy | 150 operation:NSCompositeCopy |
| 151 fraction:1.0]; | 151 fraction:1.0]; |
| 152 [NSGraphicsContext restoreGraphicsState]; | 152 [NSGraphicsContext restoreGraphicsState]; |
| 153 | 153 |
| 154 scoped_cftyperef<CGImageRef> cgImage(CGBitmapContextCreateImage(context)); | 154 scoped_cftyperef<CGImageRef> cgImage(CGBitmapContextCreateImage(context)); |
| 155 CGContextRelease(context); | 155 CGContextRelease(context); |
| 156 | 156 |
| 157 // Create the layer that will be animated. | 157 // Create the layer that will be animated. |
| 158 [layer setContents:(id)cgImage.get()]; | 158 [layer setContents:(id)cgImage.get()]; |
| 159 } | 159 } |
| 160 | 160 |
| 161 // CAAnimation delegate method called when the animation is complete. | 161 // CAAnimation delegate method called when the animation is complete. |
| 162 - (void)animationDidStop:(CAAnimation*)animation finished:(BOOL)flag { | 162 - (void)animationDidStop:(CAAnimation*)animation finished:(BOOL)flag { |
| 163 // Close the window, releasing self. | 163 // Close the window, releasing self. |
| 164 [self close]; | 164 [self close]; |
| 165 } | 165 } |
| 166 | 166 |
| 167 @end | 167 @end |
| OLD | NEW |