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