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 <android/native_window.h> |
| 9 |
8 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
9 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | 11 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
10 | 12 |
11 struct ANativeWindow; | |
12 | |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 // Implementation of GPU memory buffer based on SurfaceTextures. | 15 // Implementation of GPU memory buffer based on SurfaceTextures. |
16 class CONTENT_EXPORT GpuMemoryBufferImplSurfaceTexture | 16 class CONTENT_EXPORT GpuMemoryBufferImplSurfaceTexture |
17 : public GpuMemoryBufferImpl { | 17 : public GpuMemoryBufferImpl { |
18 public: | 18 public: |
19 ~GpuMemoryBufferImplSurfaceTexture() override; | 19 ~GpuMemoryBufferImplSurfaceTexture() override; |
20 | 20 |
21 static scoped_ptr<GpuMemoryBufferImplSurfaceTexture> CreateFromHandle( | 21 static scoped_ptr<GpuMemoryBufferImplSurfaceTexture> CreateFromHandle( |
22 const gfx::GpuMemoryBufferHandle& handle, | 22 const gfx::GpuMemoryBufferHandle& handle, |
23 const gfx::Size& size, | 23 const gfx::Size& size, |
24 gfx::BufferFormat format, | 24 gfx::BufferFormat format, |
25 gfx::BufferUsage usage, | 25 gfx::BufferUsage usage, |
26 const DestructionCallback& callback); | 26 const DestructionCallback& callback); |
27 | 27 |
28 static bool IsConfigurationSupported(gfx::BufferFormat format, | 28 static bool IsConfigurationSupported(gfx::BufferFormat format, |
29 gfx::BufferUsage usage); | 29 gfx::BufferUsage usage); |
30 | 30 |
31 static base::Closure AllocateForTesting(const gfx::Size& size, | 31 static base::Closure AllocateForTesting(const gfx::Size& size, |
32 gfx::BufferFormat format, | 32 gfx::BufferFormat format, |
33 gfx::BufferUsage usage, | 33 gfx::BufferUsage usage, |
34 gfx::GpuMemoryBufferHandle* handle); | 34 gfx::GpuMemoryBufferHandle* handle); |
35 | 35 |
36 // Overridden from gfx::GpuMemoryBuffer: | 36 // Overridden from gfx::GpuMemoryBuffer: |
37 bool Map(void** data) override; | 37 bool Map() override; |
| 38 void* memory(size_t plane) override; |
38 void Unmap() override; | 39 void Unmap() override; |
| 40 int stride(size_t plane) const override; |
39 gfx::GpuMemoryBufferHandle GetHandle() const override; | 41 gfx::GpuMemoryBufferHandle GetHandle() const override; |
40 void GetStride(int* stride) const override; | |
41 | 42 |
42 private: | 43 private: |
43 GpuMemoryBufferImplSurfaceTexture(gfx::GpuMemoryBufferId id, | 44 GpuMemoryBufferImplSurfaceTexture(gfx::GpuMemoryBufferId id, |
44 const gfx::Size& size, | 45 const gfx::Size& size, |
45 gfx::BufferFormat format, | 46 gfx::BufferFormat format, |
46 const DestructionCallback& callback, | 47 const DestructionCallback& callback, |
47 ANativeWindow* native_window); | 48 ANativeWindow* native_window); |
48 | 49 |
49 ANativeWindow* native_window_; | 50 ANativeWindow* native_window_; |
50 size_t stride_; | 51 ANativeWindow_Buffer buffer_; |
51 | 52 |
52 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSurfaceTexture); | 53 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImplSurfaceTexture); |
53 }; | 54 }; |
54 | 55 |
55 } // namespace content | 56 } // namespace content |
56 | 57 |
57 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ | 58 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_SURFACE_TEXTURE_H_ |
OLD | NEW |