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

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: Merge to LKGR. 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 base::mac::ScopedCFTypeRef<CGImageRef> image( 202 base::mac::ScopedCFTypeRef<CGImageRef> image(
203 CGBitmapContextCreateImage(cg_bitmap_)); 203 CGBitmapContextCreateImage(cg_bitmap_));
204 CGContextDrawImage(context, dest_rect, image); 204 CGContextDrawImage(context, dest_rect, image);
205 } 205 }
206 } 206 }
207 207
208 CGLayerRef BackingStoreMac::CreateCGLayer() { 208 CGLayerRef BackingStoreMac::CreateCGLayer() {
209 // The CGLayer should be optimized for drawing into the containing window, 209 // The CGLayer should be optimized for drawing into the containing window,
210 // so extract a CGContext corresponding to the window to be passed to 210 // so extract a CGContext corresponding to the window to be passed to
211 // CGLayerCreateWithContext. 211 // CGLayerCreateWithContext.
212 NSWindow* window = [render_widget_host()->view()->GetNativeView() window]; 212 NSWindow* window = [render_widget_host()->GetView()->GetNativeView() window];
213 if ([window windowNumber] <= 0) { 213 if ([window windowNumber] <= 0) {
214 // This catches a nil |window|, as well as windows that exist but that 214 // This catches a nil |window|, as well as windows that exist but that
215 // aren't yet connected to WindowServer. 215 // aren't yet connected to WindowServer.
216 return NULL; 216 return NULL;
217 } 217 }
218 218
219 NSGraphicsContext* ns_context = [window graphicsContext]; 219 NSGraphicsContext* ns_context = [window graphicsContext];
220 DCHECK(ns_context); 220 DCHECK(ns_context);
221 221
222 CGContextRef cg_context = static_cast<CGContextRef>( 222 CGContextRef cg_context = static_cast<CGContextRef>(
(...skipping 14 matching lines...) Expand all
237 CGContextRef context = CGBitmapContextCreate(NULL, 237 CGContextRef context = CGBitmapContextCreate(NULL,
238 size().width(), size().height(), 238 size().width(), size().height(),
239 8, size().width() * 4, 239 8, size().width() * 4,
240 base::mac::GetSystemColorSpace(), 240 base::mac::GetSystemColorSpace(),
241 kCGImageAlphaPremultipliedFirst | 241 kCGImageAlphaPremultipliedFirst |
242 kCGBitmapByteOrder32Host); 242 kCGBitmapByteOrder32Host);
243 DCHECK(context); 243 DCHECK(context);
244 244
245 return context; 245 return context;
246 } 246 }
OLDNEW
« no previous file with comments | « content/browser/intents/intent_injector.cc ('k') | content/browser/renderer_host/backing_store_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698