OLD | NEW |
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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
6 | 6 |
7 #include "content/common/gpu/image_transport_surface.h" | 7 #include "content/common/gpu/image_transport_surface.h" |
8 | 8 |
9 #include "base/mac/scoped_cftyperef.h" | 9 #include "base/mac/scoped_cftyperef.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 int32 render_view_id, | 82 int32 render_view_id, |
83 int32 renderer_id, | 83 int32 renderer_id, |
84 int32 command_buffer_id, | 84 int32 command_buffer_id, |
85 gfx::PluginWindowHandle handle); | 85 gfx::PluginWindowHandle handle); |
86 | 86 |
87 // GLSurface implementation | 87 // GLSurface implementation |
88 virtual bool Initialize() OVERRIDE; | 88 virtual bool Initialize() OVERRIDE; |
89 virtual void Destroy() OVERRIDE; | 89 virtual void Destroy() OVERRIDE; |
90 virtual bool IsOffscreen() OVERRIDE; | 90 virtual bool IsOffscreen() OVERRIDE; |
91 virtual bool SwapBuffers() OVERRIDE; | 91 virtual bool SwapBuffers() OVERRIDE; |
| 92 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
92 virtual std::string GetExtensions() OVERRIDE; | 93 virtual std::string GetExtensions() OVERRIDE; |
93 virtual gfx::Size GetSize() OVERRIDE; | 94 virtual gfx::Size GetSize() OVERRIDE; |
94 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 95 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
95 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 96 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
96 | 97 |
97 protected: | 98 protected: |
98 // ImageTransportSurface implementation | 99 // ImageTransportSurface implementation |
99 virtual void OnBuffersSwappedACK() OVERRIDE; | 100 virtual void OnBuffersSwappedACK() OVERRIDE; |
100 virtual void OnPostSubBufferACK() OVERRIDE; | 101 virtual void OnPostSubBufferACK() OVERRIDE; |
101 virtual void OnNewSurfaceACK(uint64 surface_id, | 102 virtual void OnNewSurfaceACK(uint64 surface_id, |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 return true; | 232 return true; |
232 } | 233 } |
233 | 234 |
234 bool IOSurfaceImageTransportSurface::PostSubBuffer( | 235 bool IOSurfaceImageTransportSurface::PostSubBuffer( |
235 int x, int y, int width, int height) { | 236 int x, int y, int width, int height) { |
236 NOTREACHED(); | 237 NOTREACHED(); |
237 return false; | 238 return false; |
238 } | 239 } |
239 | 240 |
240 std::string IOSurfaceImageTransportSurface::GetExtensions() { | 241 std::string IOSurfaceImageTransportSurface::GetExtensions() { |
241 return gfx::GLSurface::GetExtensions(); | 242 std::string extensions = gfx::GLSurface::GetExtensions(); |
| 243 extensions += extensions.empty() ? "" : " "; |
| 244 extensions += "GL_CHROMIUM_front_buffer_cached"; |
| 245 return extensions; |
242 } | 246 } |
243 | 247 |
244 gfx::Size IOSurfaceImageTransportSurface::GetSize() { | 248 gfx::Size IOSurfaceImageTransportSurface::GetSize() { |
245 return size_; | 249 return size_; |
246 } | 250 } |
247 | 251 |
248 void IOSurfaceImageTransportSurface::OnBuffersSwappedACK() { | 252 void IOSurfaceImageTransportSurface::OnBuffersSwappedACK() { |
249 helper_->SetScheduled(true); | 253 helper_->SetScheduled(true); |
250 } | 254 } |
251 | 255 |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, previous_fbo_id); | 448 glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, previous_fbo_id); |
445 | 449 |
446 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; | 450 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; |
447 params.surface_id = next_id_; | 451 params.surface_id = next_id_; |
448 helper_->SendAcceleratedSurfaceBuffersSwapped(params); | 452 helper_->SendAcceleratedSurfaceBuffersSwapped(params); |
449 | 453 |
450 helper_->SetScheduled(false); | 454 helper_->SetScheduled(false); |
451 return true; | 455 return true; |
452 } | 456 } |
453 | 457 |
| 458 bool TransportDIBImageTransportSurface::PostSubBuffer( |
| 459 int x, int y, int width, int height) { |
| 460 NOTREACHED(); |
| 461 return false; |
| 462 } |
| 463 |
454 std::string TransportDIBImageTransportSurface::GetExtensions() { | 464 std::string TransportDIBImageTransportSurface::GetExtensions() { |
455 return gfx::GLSurface::GetExtensions(); | 465 std::string extensions = gfx::GLSurface::GetExtensions(); |
| 466 extensions += extensions.empty() ? "" : " "; |
| 467 extensions += "GL_CHROMIUM_front_buffer_cached"; |
| 468 return extensions; |
456 } | 469 } |
457 | 470 |
458 gfx::Size TransportDIBImageTransportSurface::GetSize() { | 471 gfx::Size TransportDIBImageTransportSurface::GetSize() { |
459 return size_; | 472 return size_; |
460 } | 473 } |
461 | 474 |
462 void TransportDIBImageTransportSurface::OnBuffersSwappedACK() { | 475 void TransportDIBImageTransportSurface::OnBuffersSwappedACK() { |
463 helper_->SetScheduled(true); | 476 helper_->SetScheduled(true); |
464 } | 477 } |
465 | 478 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 NOTREACHED(); | 561 NOTREACHED(); |
549 return NULL; | 562 return NULL; |
550 } | 563 } |
551 if (surface->Initialize()) | 564 if (surface->Initialize()) |
552 return surface; | 565 return surface; |
553 else | 566 else |
554 return NULL; | 567 return NULL; |
555 } | 568 } |
556 | 569 |
557 #endif // defined(USE_GPU) | 570 #endif // defined(USE_GPU) |
OLD | NEW |