| OLD | NEW |
| 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 #ifndef CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ | 5 #ifndef CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ |
| 6 #define CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ | 6 #define CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "content/common/gpu/gpu_command_buffer_stub.h" | 10 #include "content/common/gpu/gpu_command_buffer_stub.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 virtual void Destroy() OVERRIDE; | 28 virtual void Destroy() OVERRIDE; |
| 29 virtual bool Resize(const gfx::Size& size) OVERRIDE; | 29 virtual bool Resize(const gfx::Size& size) OVERRIDE; |
| 30 virtual bool IsOffscreen() OVERRIDE; | 30 virtual bool IsOffscreen() OVERRIDE; |
| 31 virtual bool SwapBuffers() OVERRIDE; | 31 virtual bool SwapBuffers() OVERRIDE; |
| 32 virtual gfx::Size GetSize() OVERRIDE; | 32 virtual gfx::Size GetSize() OVERRIDE; |
| 33 virtual void* GetHandle() OVERRIDE; | 33 virtual void* GetHandle() OVERRIDE; |
| 34 virtual std::string GetExtensions() OVERRIDE; | 34 virtual std::string GetExtensions() OVERRIDE; |
| 35 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; | 35 virtual unsigned int GetBackingFrameBufferObject() OVERRIDE; |
| 36 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 36 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
| 37 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 37 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
| 38 virtual void SetBufferAllocation(BufferAllocationState state) OVERRIDE; | 38 virtual void SetBackbufferAllocation(bool allocated) OVERRIDE; |
| 39 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
| 39 virtual void* GetShareHandle() OVERRIDE; | 40 virtual void* GetShareHandle() OVERRIDE; |
| 40 virtual void* GetDisplay() OVERRIDE; | 41 virtual void* GetDisplay() OVERRIDE; |
| 41 virtual void* GetConfig() OVERRIDE; | 42 virtual void* GetConfig() OVERRIDE; |
| 42 | 43 |
| 43 protected: | 44 protected: |
| 44 // ImageTransportSurface implementation. | 45 // ImageTransportSurface implementation. |
| 45 virtual void OnNewSurfaceACK( | 46 virtual void OnNewSurfaceACK( |
| 46 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; | 47 uint64 surface_handle, TransportDIB::Handle shm_handle) OVERRIDE; |
| 47 virtual void OnBuffersSwappedACK() OVERRIDE; | 48 virtual void OnBuffersSwappedACK() OVERRIDE; |
| 48 virtual void OnPostSubBufferACK() OVERRIDE; | 49 virtual void OnPostSubBufferACK() OVERRIDE; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 70 // The texture info in the parent stub. | 71 // The texture info in the parent stub. |
| 71 gpu::gles2::TextureManager::TextureInfo::Ref info; | 72 gpu::gles2::TextureManager::TextureInfo::Ref info; |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 virtual ~TextureImageTransportSurface(); | 75 virtual ~TextureImageTransportSurface(); |
| 75 void CreateBackTexture(const gfx::Size& size); | 76 void CreateBackTexture(const gfx::Size& size); |
| 76 void ReleaseBackTexture(); | 77 void ReleaseBackTexture(); |
| 77 void AttachBackTextureToFBO(); | 78 void AttachBackTextureToFBO(); |
| 78 void ReleaseParentStub(); | 79 void ReleaseParentStub(); |
| 79 int back() const { return 1 - front_; } | 80 int back() const { return 1 - front_; } |
| 81 void AdjustBufferAllocations(); |
| 80 | 82 |
| 81 // The framebuffer that represents this surface (service id). Allocated lazily | 83 // The framebuffer that represents this surface (service id). Allocated lazily |
| 82 // in OnMakeCurrent. | 84 // in OnMakeCurrent. |
| 83 uint32 fbo_id_; | 85 uint32 fbo_id_; |
| 84 | 86 |
| 85 // The front and back buffers. | 87 // The front and back buffers. |
| 86 Texture textures_[2]; | 88 Texture textures_[2]; |
| 87 | 89 |
| 88 gfx::Rect previous_damage_rect_; | 90 gfx::Rect previous_damage_rect_; |
| 89 | 91 |
| 90 // Indicates which of the 2 above is the front buffer. | 92 // Indicates which of the 2 above is the front buffer. |
| 91 int front_; | 93 int front_; |
| 92 | 94 |
| 93 // Whether or not the command buffer stub has been destroyed. | 95 // Whether or not the command buffer stub has been destroyed. |
| 94 bool stub_destroyed_; | 96 bool stub_destroyed_; |
| 95 | 97 |
| 98 bool backbuffer_suggested_allocation_; |
| 99 bool frontbuffer_suggested_allocation_; |
| 100 |
| 96 scoped_ptr<ImageTransportHelper> helper_; | 101 scoped_ptr<ImageTransportHelper> helper_; |
| 97 GpuCommandBufferStub* parent_stub_; | 102 GpuCommandBufferStub* parent_stub_; |
| 98 | 103 |
| 99 DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); | 104 DISALLOW_COPY_AND_ASSIGN(TextureImageTransportSurface); |
| 100 }; | 105 }; |
| 101 | 106 |
| 102 #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ | 107 #endif // CONTENT_COMMON_GPU_TEXTURE_IMAGE_TRANSPORT_SURFACE_H_ |
| OLD | NEW |