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

Side by Side Diff: chrome/browser/cocoa/animatable_image.mm

Issue 3005018: Load the download animation image as an NSImage rather than a CGImageRef. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 years, 5 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 | chrome/browser/cocoa/download_started_animation_mac.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 #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
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
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/cocoa/download_started_animation_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698