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