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

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

Issue 7144007: Improve and unify Mac OS X run-time version checks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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"
11 #include "base/mac/scoped_cftyperef.h" 11 #include "base/mac/scoped_cftyperef.h"
12 #include "base/sys_info.h"
13 #include "content/browser/renderer_host/render_process_host.h" 12 #include "content/browser/renderer_host/render_process_host.h"
14 #include "content/browser/renderer_host/render_widget_host.h" 13 #include "content/browser/renderer_host/render_widget_host.h"
15 #include "content/browser/renderer_host/render_widget_host_view.h" 14 #include "content/browser/renderer_host/render_widget_host_view.h"
16 #include "skia/ext/platform_canvas.h" 15 #include "skia/ext/platform_canvas.h"
17 #include "third_party/skia/include/core/SkBitmap.h" 16 #include "third_party/skia/include/core/SkBitmap.h"
18 #include "third_party/skia/include/core/SkCanvas.h" 17 #include "third_party/skia/include/core/SkCanvas.h"
19 #include "ui/gfx/rect.h" 18 #include "ui/gfx/rect.h"
20 #include "ui/gfx/surface/transport_dib.h" 19 #include "ui/gfx/surface/transport_dib.h"
21 20
22 // Mac Backing Stores: 21 // Mac Backing Stores:
23 // 22 //
24 // Since backing stores are only ever written to or drawn into windows, we keep 23 // Since backing stores are only ever written to or drawn into windows, we keep
25 // our backing store in a CGLayer that can get cached in GPU memory. This 24 // our backing store in a CGLayer that can get cached in GPU memory. This
26 // allows acclerated drawing into the layer and lets scrolling and such happen 25 // allows acclerated drawing into the layer and lets scrolling and such happen
27 // all or mostly on the GPU, which is good for performance. 26 // all or mostly on the GPU, which is good for performance.
28 27
29 namespace { 28 namespace {
30 29
31 // Returns whether this version of OS X has broken CGLayers, see 30 // Returns whether this version of OS X has broken CGLayers, see
32 // http://crbug.com/45553 , comments 5 and 6. 31 // http://crbug.com/45553 , comments 5 and 6.
33 bool NeedsLayerWorkaround() { 32 bool NeedsLayerWorkaround() {
34 int32 os_major, os_minor, os_bugfix; 33 return base::mac::IsOSLeopard();
35 base::SysInfo::OperatingSystemVersionNumbers(
36 &os_major, &os_minor, &os_bugfix);
37 return os_major == 10 && os_minor == 5;
38 } 34 }
39 35
40 } // namespace 36 } // namespace
41 37
42 BackingStoreMac::BackingStoreMac(RenderWidgetHost* widget, 38 BackingStoreMac::BackingStoreMac(RenderWidgetHost* widget,
43 const gfx::Size& size) 39 const gfx::Size& size)
44 : BackingStore(widget, size) { 40 : BackingStore(widget, size) {
45 cg_layer_.reset(CreateCGLayer()); 41 cg_layer_.reset(CreateCGLayer());
46 if (!cg_layer_) { 42 if (!cg_layer_) {
47 // The view isn't in a window yet. Use a CGBitmapContext for now. 43 // The view isn't in a window yet. Use a CGBitmapContext for now.
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 CGContextRef context = CGBitmapContextCreate(NULL, 229 CGContextRef context = CGBitmapContextCreate(NULL,
234 size().width(), size().height(), 230 size().width(), size().height(),
235 8, size().width() * 4, 231 8, size().width() * 4,
236 base::mac::GetSystemColorSpace(), 232 base::mac::GetSystemColorSpace(),
237 kCGImageAlphaPremultipliedFirst | 233 kCGImageAlphaPremultipliedFirst |
238 kCGBitmapByteOrder32Host); 234 kCGBitmapByteOrder32Host);
239 DCHECK(context); 235 DCHECK(context);
240 236
241 return context; 237 return context;
242 } 238 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698