OLD | NEW |
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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "chrome/browser/renderer_host/backing_store_mac.h" | 7 #include "chrome/browser/renderer_host/backing_store_mac.h" |
8 | 8 |
9 #include "app/surface/transport_dib.h" | 9 #include "app/surface/transport_dib.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 } | 49 } |
50 } | 50 } |
51 | 51 |
52 BackingStoreMac::~BackingStoreMac() { | 52 BackingStoreMac::~BackingStoreMac() { |
53 } | 53 } |
54 | 54 |
55 void BackingStoreMac::PaintToBackingStore( | 55 void BackingStoreMac::PaintToBackingStore( |
56 RenderProcessHost* process, | 56 RenderProcessHost* process, |
57 TransportDIB::Id bitmap, | 57 TransportDIB::Id bitmap, |
58 const gfx::Rect& bitmap_rect, | 58 const gfx::Rect& bitmap_rect, |
59 const std::vector<gfx::Rect>& copy_rects, | 59 const std::vector<gfx::Rect>& copy_rects) { |
60 bool* painted_synchronously) { | |
61 // Our paints are always synchronous and the caller can free the TransportDIB, | |
62 // even on failure. | |
63 *painted_synchronously = true; | |
64 | |
65 DCHECK_NE(static_cast<bool>(cg_layer()), static_cast<bool>(cg_bitmap())); | 60 DCHECK_NE(static_cast<bool>(cg_layer()), static_cast<bool>(cg_bitmap())); |
66 | 61 |
67 TransportDIB* dib = process->GetTransportDIB(bitmap); | 62 TransportDIB* dib = process->GetTransportDIB(bitmap); |
68 if (!dib) | 63 if (!dib) |
69 return; | 64 return; |
70 | 65 |
71 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider( | 66 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider( |
72 CGDataProviderCreateWithData(NULL, dib->memory(), | 67 CGDataProviderCreateWithData(NULL, dib->memory(), |
73 bitmap_rect.width() * bitmap_rect.height() * 4, NULL)); | 68 bitmap_rect.width() * bitmap_rect.height() * 4, NULL)); |
74 | 69 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
238 CGContextRef context = CGBitmapContextCreate(NULL, | 233 CGContextRef context = CGBitmapContextCreate(NULL, |
239 size().width(), size().height(), | 234 size().width(), size().height(), |
240 8, size().width() * 4, | 235 8, size().width() * 4, |
241 mac_util::GetSystemColorSpace(), | 236 mac_util::GetSystemColorSpace(), |
242 kCGImageAlphaPremultipliedFirst | | 237 kCGImageAlphaPremultipliedFirst | |
243 kCGBitmapByteOrder32Host); | 238 kCGBitmapByteOrder32Host); |
244 DCHECK(context); | 239 DCHECK(context); |
245 | 240 |
246 return context; | 241 return context; |
247 } | 242 } |
OLD | NEW |