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

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

Issue 10905036: Pepper Flash Mac: Fix crash when playing video on MB retina (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: disable test on windows Created 8 years, 3 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
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 *scheduled_completion_callback = false; 80 *scheduled_completion_callback = false;
81 DCHECK_NE(static_cast<bool>(cg_layer()), static_cast<bool>(cg_bitmap())); 81 DCHECK_NE(static_cast<bool>(cg_layer()), static_cast<bool>(cg_bitmap()));
82 82
83 TransportDIB* dib = process->GetTransportDIB(bitmap); 83 TransportDIB* dib = process->GetTransportDIB(bitmap);
84 if (!dib) 84 if (!dib)
85 return; 85 return;
86 86
87 gfx::Size pixel_size = size().Scale(device_scale_factor_); 87 gfx::Size pixel_size = size().Scale(device_scale_factor_);
88 gfx::Rect pixel_bitmap_rect = bitmap_rect.Scale(scale_factor); 88 gfx::Rect pixel_bitmap_rect = bitmap_rect.Scale(scale_factor);
89 89
90 size_t bitmap_byte_count =
91 pixel_bitmap_rect.width() * pixel_bitmap_rect.height() * 4;
92 DCHECK_GE(dib->size(), bitmap_byte_count);
93
90 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider( 94 base::mac::ScopedCFTypeRef<CGDataProviderRef> data_provider(
91 CGDataProviderCreateWithData(NULL, dib->memory(), 95 CGDataProviderCreateWithData(NULL, dib->memory(),
92 pixel_bitmap_rect.width() * pixel_bitmap_rect.height() * 4, NULL)); 96 bitmap_byte_count, NULL));
93 97
94 base::mac::ScopedCFTypeRef<CGImageRef> bitmap_image( 98 base::mac::ScopedCFTypeRef<CGImageRef> bitmap_image(
95 CGImageCreate(pixel_bitmap_rect.width(), pixel_bitmap_rect.height(), 99 CGImageCreate(pixel_bitmap_rect.width(), pixel_bitmap_rect.height(),
96 8, 32, 4 * pixel_bitmap_rect.width(), 100 8, 32, 4 * pixel_bitmap_rect.width(),
97 base::mac::GetSystemColorSpace(), 101 base::mac::GetSystemColorSpace(),
98 kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, 102 kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host,
99 data_provider, NULL, false, kCGRenderingIntentDefault)); 103 data_provider, NULL, false, kCGRenderingIntentDefault));
100 104
101 for (size_t i = 0; i < copy_rects.size(); i++) { 105 for (size_t i = 0; i < copy_rects.size(); i++) {
102 const gfx::Rect& copy_rect = copy_rects[i]; 106 const gfx::Rect& copy_rect = copy_rects[i];
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 8, pixel_size.width() * 4, 264 8, pixel_size.width() * 4,
261 base::mac::GetSystemColorSpace(), 265 base::mac::GetSystemColorSpace(),
262 kCGImageAlphaPremultipliedFirst | 266 kCGImageAlphaPremultipliedFirst |
263 kCGBitmapByteOrder32Host); 267 kCGBitmapByteOrder32Host);
264 DCHECK(context); 268 DCHECK(context);
265 269
266 return context; 270 return context;
267 } 271 }
268 272
269 } // namespace content 273 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698