OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/common/gpu/image_transport_surface_fbo_mac.h" | 5 #include "content/common/gpu/image_transport_surface_fbo_mac.h" |
6 | 6 |
7 #include "content/common/gpu/gpu_messages.h" | 7 #include "content/common/gpu/gpu_messages.h" |
8 #include "content/common/gpu/image_transport_surface_calayer_mac.h" | 8 #include "content/common/gpu/image_transport_surface_calayer_mac.h" |
9 #include "content/common/gpu/image_transport_surface_iosurface_mac.h" | 9 #include "content/common/gpu/image_transport_surface_iosurface_mac.h" |
| 10 #include "ui/base/cocoa/remote_layer_api.h" |
10 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" |
11 #include "ui/gl/gl_context.h" | 12 #include "ui/gl/gl_context.h" |
12 #include "ui/gl/gl_implementation.h" | 13 #include "ui/gl/gl_implementation.h" |
13 #include "ui/gl/gl_surface_osmesa.h" | 14 #include "ui/gl/gl_surface_osmesa.h" |
14 | 15 |
15 namespace content { | 16 namespace content { |
16 | 17 |
17 ImageTransportSurfaceFBO::ImageTransportSurfaceFBO( | 18 ImageTransportSurfaceFBO::ImageTransportSurfaceFBO( |
18 GpuChannelManager* manager, | 19 GpuChannelManager* manager, |
19 GpuCommandBufferStub* stub, | 20 GpuCommandBufferStub* stub, |
20 gfx::PluginWindowHandle handle) | 21 gfx::PluginWindowHandle handle) |
21 : backbuffer_suggested_allocation_(true), | 22 : backbuffer_suggested_allocation_(true), |
22 frontbuffer_suggested_allocation_(true), | 23 frontbuffer_suggested_allocation_(true), |
23 fbo_id_(0), | 24 fbo_id_(0), |
24 texture_id_(0), | 25 texture_id_(0), |
25 depth_stencil_renderbuffer_id_(0), | 26 depth_stencil_renderbuffer_id_(0), |
26 has_complete_framebuffer_(false), | 27 has_complete_framebuffer_(false), |
27 context_(NULL), | 28 context_(NULL), |
28 scale_factor_(1.f), | 29 scale_factor_(1.f), |
29 made_current_(false), | 30 made_current_(false), |
30 is_swap_buffers_pending_(false), | 31 is_swap_buffers_pending_(false), |
31 did_unschedule_(false) { | 32 did_unschedule_(false) { |
32 // TODO(ccameron): If the remote layer API is supported on this system, | 33 if (ui::RemoteLayerAPISupported()) |
33 // use a CALayerStorageProvider instead of an IOSurfaceStorageProvider. | 34 storage_provider_.reset(new CALayerStorageProvider(this)); |
34 storage_provider_.reset(new IOSurfaceStorageProvider(this)); | 35 else |
| 36 storage_provider_.reset(new IOSurfaceStorageProvider(this)); |
35 helper_.reset(new ImageTransportHelper(this, manager, stub, handle)); | 37 helper_.reset(new ImageTransportHelper(this, manager, stub, handle)); |
36 } | 38 } |
37 | 39 |
38 ImageTransportSurfaceFBO::~ImageTransportSurfaceFBO() { | 40 ImageTransportSurfaceFBO::~ImageTransportSurfaceFBO() { |
39 } | 41 } |
40 | 42 |
41 bool ImageTransportSurfaceFBO::Initialize() { | 43 bool ImageTransportSurfaceFBO::Initialize() { |
42 // Only support IOSurfaces if the GL implementation is the native desktop GL. | 44 // Only support IOSurfaces if the GL implementation is the native desktop GL. |
43 // IO surfaces will not work with, for example, OSMesa software renderer | 45 // IO surfaces will not work with, for example, OSMesa software renderer |
44 // GL contexts. | 46 // GL contexts. |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
327 return; | 329 return; |
328 } | 330 } |
329 | 331 |
330 has_complete_framebuffer_ = true; | 332 has_complete_framebuffer_ = true; |
331 | 333 |
332 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, previous_texture_id); | 334 glBindTexture(GL_TEXTURE_RECTANGLE_ARB, previous_texture_id); |
333 // The FBO remains bound for this GL context. | 335 // The FBO remains bound for this GL context. |
334 } | 336 } |
335 | 337 |
336 } // namespace content | 338 } // namespace content |
OLD | NEW |