| 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 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ |
| 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ |
| 7 | 7 |
| 8 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | 8 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
| 9 | 9 |
| 10 struct ANativeWindow; | 10 struct ANativeWindow; |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 // Implementation of GPU memory buffer based on SurfaceTextures. | 14 // Implementation of GPU memory buffer based on SurfaceTextures. |
| 15 class GpuMemoryBufferImplSurfaceTexture : public GpuMemoryBufferImpl { | 15 class GpuMemoryBufferImplSurfaceTexture : public GpuMemoryBufferImpl { |
| 16 public: | 16 public: |
| 17 GpuMemoryBufferImplSurfaceTexture(const gfx::Size& size, | 17 GpuMemoryBufferImplSurfaceTexture(const gfx::Size& size, |
| 18 unsigned internalformat); | 18 unsigned internalformat, |
| 19 const DestructionCallback& callback); |
| 19 virtual ~GpuMemoryBufferImplSurfaceTexture(); | 20 virtual ~GpuMemoryBufferImplSurfaceTexture(); |
| 20 | 21 |
| 21 static bool IsFormatSupported(unsigned internalformat); | 22 static bool IsFormatSupported(unsigned internalformat); |
| 22 static bool IsUsageSupported(unsigned usage); | 23 static bool IsUsageSupported(unsigned usage); |
| 23 static bool IsConfigurationSupported(unsigned internalformat, unsigned usage); | 24 static bool IsConfigurationSupported(unsigned internalformat, unsigned usage); |
| 24 static int WindowFormat(unsigned internalformat); | 25 static int WindowFormat(unsigned internalformat); |
| 25 | 26 |
| 26 bool InitializeFromHandle(const gfx::GpuMemoryBufferHandle& handle); | 27 bool InitializeFromHandle(const gfx::GpuMemoryBufferHandle& handle); |
| 27 | 28 |
| 28 // Overridden from gfx::GpuMemoryBuffer: | 29 // Overridden from gfx::GpuMemoryBuffer: |
| 29 virtual void* Map() OVERRIDE; | 30 virtual void* Map() OVERRIDE; |
| 30 virtual void Unmap() OVERRIDE; | 31 virtual void Unmap() OVERRIDE; |
| 31 virtual gfx::GpuMemoryBufferHandle GetHandle() const OVERRIDE; | 32 virtual gfx::GpuMemoryBufferHandle GetHandle() const OVERRIDE; |
| 32 virtual uint32 GetStride() const OVERRIDE; | 33 virtual uint32 GetStride() const OVERRIDE; |
| 33 | 34 |
| 34 private: | 35 private: |
| 36 const DestructionCallback callback_; |
| 35 gfx::SurfaceTextureId surface_texture_id_; | 37 gfx::SurfaceTextureId surface_texture_id_; |
| 36 ANativeWindow* native_window_; | 38 ANativeWindow* native_window_; |
| 37 size_t stride_; | 39 size_t stride_; |
| 38 | 40 |
| 39 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSurfaceTexture); | 41 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSurfaceTexture); |
| 40 }; | 42 }; |
| 41 | 43 |
| 42 } // namespace content | 44 } // namespace content |
| 43 | 45 |
| 44 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ | 46 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ |
| OLD | NEW |