OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "content/browser/renderer_host/backing_store_mac.h" | 7 #include "content/browser/renderer_host/backing_store_mac.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/mac_util.h" | 10 #include "base/mac/mac_util.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 bitmap_image); | 188 bitmap_image); |
189 CGContextRestoreGState(cg_bitmap_); | 189 CGContextRestoreGState(cg_bitmap_); |
190 } | 190 } |
191 } | 191 } |
192 } | 192 } |
193 | 193 |
194 CGLayerRef BackingStoreMac::CreateCGLayer() { | 194 CGLayerRef BackingStoreMac::CreateCGLayer() { |
195 // The CGLayer should be optimized for drawing into the containing window, | 195 // The CGLayer should be optimized for drawing into the containing window, |
196 // so extract a CGContext corresponding to the window to be passed to | 196 // so extract a CGContext corresponding to the window to be passed to |
197 // CGLayerCreateWithContext. | 197 // CGLayerCreateWithContext. |
198 NSWindow* window = [render_widget_host()->view()->GetNativeView() window]; | 198 NSWindow* window = [render_widget_host()->GetView()->GetNativeView() window]; |
199 if ([window windowNumber] <= 0) { | 199 if ([window windowNumber] <= 0) { |
200 // This catches a nil |window|, as well as windows that exist but that | 200 // This catches a nil |window|, as well as windows that exist but that |
201 // aren't yet connected to WindowServer. | 201 // aren't yet connected to WindowServer. |
202 return NULL; | 202 return NULL; |
203 } | 203 } |
204 | 204 |
205 NSGraphicsContext* ns_context = [window graphicsContext]; | 205 NSGraphicsContext* ns_context = [window graphicsContext]; |
206 DCHECK(ns_context); | 206 DCHECK(ns_context); |
207 | 207 |
208 CGContextRef cg_context = static_cast<CGContextRef>( | 208 CGContextRef cg_context = static_cast<CGContextRef>( |
(...skipping 14 matching lines...) Expand all Loading... |
223 CGContextRef context = CGBitmapContextCreate(NULL, | 223 CGContextRef context = CGBitmapContextCreate(NULL, |
224 size().width(), size().height(), | 224 size().width(), size().height(), |
225 8, size().width() * 4, | 225 8, size().width() * 4, |
226 base::mac::GetSystemColorSpace(), | 226 base::mac::GetSystemColorSpace(), |
227 kCGImageAlphaPremultipliedFirst | | 227 kCGImageAlphaPremultipliedFirst | |
228 kCGBitmapByteOrder32Host); | 228 kCGBitmapByteOrder32Host); |
229 DCHECK(context); | 229 DCHECK(context); |
230 | 230 |
231 return context; | 231 return context; |
232 } | 232 } |
OLD | NEW |