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

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

Issue 3834003: On Windows, create a new TransportDIB::Handle struct which includes the file (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Rebase Created 10 years, 2 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
OLDNEW
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 // The view isn't in a window yet. Use a CGBitmapContext for now. 47 // The view isn't in a window yet. Use a CGBitmapContext for now.
48 cg_bitmap_.reset(CreateCGBitmapContext()); 48 cg_bitmap_.reset(CreateCGBitmapContext());
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 dib_id,
58 TransportDIB::Handle dib_handle,
58 const gfx::Rect& bitmap_rect, 59 const gfx::Rect& bitmap_rect,
59 const std::vector<gfx::Rect>& copy_rects, 60 const std::vector<gfx::Rect>& copy_rects,
60 bool* painted_synchronously) { 61 bool* painted_synchronously) {
61 // Our paints are always synchronous and the caller can free the TransportDIB, 62 // Our paints are always synchronous and the caller can free the TransportDIB,
62 // even on failure. 63 // even on failure.
63 *painted_synchronously = true; 64 *painted_synchronously = true;
64 65
65 DCHECK_NE(static_cast<bool>(cg_layer()), static_cast<bool>(cg_bitmap())); 66 DCHECK_NE(static_cast<bool>(cg_layer()), static_cast<bool>(cg_bitmap()));
66 67
67 TransportDIB* dib = process->GetTransportDIB(bitmap); 68 TransportDIB* dib = process->GetTransportDIB(dib_id, dib_handle);
68 if (!dib) 69 if (!dib)
69 return; 70 return;
70 71
71 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider( 72 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider(
72 CGDataProviderCreateWithData(NULL, dib->memory(), 73 CGDataProviderCreateWithData(NULL, dib->memory(),
73 bitmap_rect.width() * bitmap_rect.height() * 4, NULL)); 74 bitmap_rect.width() * bitmap_rect.height() * 4, NULL));
74 75
75 base::mac::ScopedCFTypeRef<CGImageRef> bitmap_image( 76 base::mac::ScopedCFTypeRef<CGImageRef> bitmap_image(
76 CGImageCreate(bitmap_rect.width(), bitmap_rect.height(), 8, 32, 77 CGImageCreate(bitmap_rect.width(), bitmap_rect.height(), 8, 32,
77 4 * bitmap_rect.width(), mac_util::GetSystemColorSpace(), 78 4 * bitmap_rect.width(), mac_util::GetSystemColorSpace(),
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 CGContextRef context = CGBitmapContextCreate(NULL, 239 CGContextRef context = CGBitmapContextCreate(NULL,
239 size().width(), size().height(), 240 size().width(), size().height(),
240 8, size().width() * 4, 241 8, size().width() * 4,
241 mac_util::GetSystemColorSpace(), 242 mac_util::GetSystemColorSpace(),
242 kCGImageAlphaPremultipliedFirst | 243 kCGImageAlphaPremultipliedFirst |
243 kCGBitmapByteOrder32Host); 244 kCGBitmapByteOrder32Host);
244 DCHECK(context); 245 DCHECK(context);
245 246
246 return context; 247 return context;
247 } 248 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698