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

Side by Side Diff: content/browser/renderer_host/backing_store_mac.mm

Issue 9473001: Extract minimal RenderViewHost interface for embedders, leaving (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ready for initial review. Created 8 years, 9 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 | Annotate | Revision Log
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698