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

Unified Diff: chrome/browser/renderer_host/render_widget_host_view_mac.mm

Issue 175027: Update BackingStore to handle the case where our Cocoa view has... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/renderer_host/backing_store_mac.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/render_widget_host_view_mac.mm
===================================================================
--- chrome/browser/renderer_host/render_widget_host_view_mac.mm (revision 24883)
+++ chrome/browser/renderer_host/render_widget_host_view_mac.mm (working copy)
@@ -549,7 +549,7 @@
renderWidgetHostView_->about_to_validate_and_paint_ = false;
dirtyRect = renderWidgetHostView_->invalid_rect_;
- if (backing_store && backing_store->cg_layer()) {
+ if (backing_store) {
NSRect view_bounds = [self bounds];
gfx::Rect damaged_rect([self NSRectToRect:dirtyRect]);
@@ -559,12 +559,24 @@
gfx::Rect paint_rect = bitmap_rect.Intersect(damaged_rect);
if (!paint_rect.IsEmpty()) {
- CGContextRef context = static_cast<CGContextRef>(
- [[NSGraphicsContext currentContext] graphicsPort]);
+ // if we have a CGLayer, draw that into the window
+ if (backing_store->cg_layer()) {
+ CGContextRef context = static_cast<CGContextRef>(
+ [[NSGraphicsContext currentContext] graphicsPort]);
- // TODO: add clipping to dirtyRect if it improves drawing performance.
- CGContextDrawLayerAtPoint(context, CGPointMake(0.0, 0.0),
- backing_store->cg_layer());
+ // TODO: add clipping to dirtyRect if it improves drawing performance.
+ CGContextDrawLayerAtPoint(context, CGPointMake(0.0, 0.0),
+ backing_store->cg_layer());
+ } else {
+ // if we haven't created a layer yet, draw the cached bitmap into
+ // the window. The CGLayer will be created the next time the renderer
+ // paints.
+ CGContextRef context = static_cast<CGContextRef>(
+ [[NSGraphicsContext currentContext] graphicsPort]);
+ scoped_cftyperef<CGImageRef> image(
+ CGBitmapContextCreateImage(backing_store->cg_bitmap()));
rohitrao (ping after 24h) 2009/08/31 21:18:13 What will happen if cg_bitmap() returns NULL? Do
Amanda Walker 2009/08/31 21:22:30 Since one or the other always gets created in the
+ CGContextDrawImage(context, bitmap_rect.ToCGRect(), image);
+ }
}
// Fill the remaining portion of the damaged_rect with white
« no previous file with comments | « chrome/browser/renderer_host/backing_store_mac.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698