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 #include "app/surface/accelerated_surface_mac.h" | 5 #include "app/surface/accelerated_surface_mac.h" |
6 | 6 |
7 #include "app/gfx/gl/gl_bindings.h" | 7 #include "app/gfx/gl/gl_bindings.h" |
8 #include "app/gfx/gl/gl_implementation.h" | 8 #include "app/gfx/gl/gl_implementation.h" |
9 #include "app/surface/io_surface_support_mac.h" | 9 #include "app/surface/io_surface_support_mac.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/mac/scoped_cftyperef.h" | 11 #include "base/mac/scoped_cftyperef.h" |
12 #include "ui/gfx/rect.h" | 12 #include "ui/gfx/rect.h" |
13 | 13 |
14 AcceleratedSurface::AcceleratedSurface() | 14 AcceleratedSurface::AcceleratedSurface() |
15 : io_surface_id_(0), | 15 : io_surface_id_(0), |
16 allocate_fbo_(false), | 16 allocate_fbo_(false), |
17 texture_(0), | 17 texture_(0), |
18 fbo_(0), | 18 fbo_(0), |
19 depth_stencil_renderbuffer_(0) { | 19 depth_stencil_renderbuffer_(0) { |
20 } | 20 } |
21 | 21 |
| 22 AcceleratedSurface::~AcceleratedSurface() {} |
| 23 |
22 bool AcceleratedSurface::Initialize(gfx::GLContext* share_context, | 24 bool AcceleratedSurface::Initialize(gfx::GLContext* share_context, |
23 bool allocate_fbo) { | 25 bool allocate_fbo) { |
24 allocate_fbo_ = allocate_fbo; | 26 allocate_fbo_ = allocate_fbo; |
25 | 27 |
26 // Ensure GL is initialized before trying to create an offscreen GL context. | 28 // Ensure GL is initialized before trying to create an offscreen GL context. |
27 if (!gfx::GLContext::InitializeOneOff()) | 29 if (!gfx::GLContext::InitializeOneOff()) |
28 return false; | 30 return false; |
29 | 31 |
30 // Drawing to IOSurfaces via OpenGL only works with desktop GL and | 32 // Drawing to IOSurfaces via OpenGL only works with desktop GL and |
31 // not with the OSMesa software renderer. | 33 // not with the OSMesa software renderer. |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 } | 338 } |
337 return transport_dib_->handle(); | 339 return transport_dib_->handle(); |
338 } | 340 } |
339 | 341 |
340 void AcceleratedSurface::SetTransportDIBAllocAndFree( | 342 void AcceleratedSurface::SetTransportDIBAllocAndFree( |
341 Callback2<size_t, TransportDIB::Handle*>::Type* allocator, | 343 Callback2<size_t, TransportDIB::Handle*>::Type* allocator, |
342 Callback1<TransportDIB::Id>::Type* deallocator) { | 344 Callback1<TransportDIB::Id>::Type* deallocator) { |
343 dib_alloc_callback_.reset(allocator); | 345 dib_alloc_callback_.reset(allocator); |
344 dib_free_callback_.reset(deallocator); | 346 dib_free_callback_.reset(deallocator); |
345 } | 347 } |
OLD | NEW |