OLD | NEW |
| (Empty) |
1 // Copyright 2013 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 ANDROID_WEBVIEW_BROWSER_GPU_MEMORY_BUFFER_IMPL_H_ | |
6 #define ANDROID_WEBVIEW_BROWSER_GPU_MEMORY_BUFFER_IMPL_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "base/compiler_specific.h" | |
10 #include "gpu/command_buffer/client/gpu_memory_buffer.h" | |
11 #include "ui/gfx/size.h" | |
12 | |
13 struct AwDrawGLFunctionTable; | |
14 | |
15 namespace android_webview { | |
16 | |
17 class GpuMemoryBufferImpl : public gpu::GpuMemoryBuffer { | |
18 public: | |
19 static scoped_ptr<gpu::GpuMemoryBuffer> CreateGpuMemoryBuffer(int width, | |
20 int height); | |
21 static void SetAwDrawGLFunctionTable(AwDrawGLFunctionTable* table); | |
22 GpuMemoryBufferImpl(gfx::Size size); | |
23 virtual ~GpuMemoryBufferImpl(); | |
24 | |
25 // methods from GpuMemoryBuffer | |
26 virtual void Map(gpu::GpuMemoryBuffer::AccessMode mode, | |
27 void** vaddr) OVERRIDE; | |
28 virtual void Unmap() OVERRIDE; | |
29 virtual bool IsMapped() OVERRIDE; | |
30 virtual void* GetNativeBuffer() OVERRIDE; | |
31 virtual uint32 GetStride() OVERRIDE; | |
32 | |
33 private: | |
34 // Returns true iff the buffer was allocated successfully. | |
35 bool InitCheck(); | |
36 | |
37 int buffer_id_; | |
38 gfx::Size size_; | |
39 bool mapped_; | |
40 | |
41 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); | |
42 }; | |
43 | |
44 } // namespace android_webview | |
45 | |
46 #endif // ANDROID_WEBVIEW_BROWSER_GPU_MEMORY_BUFFER_IMPL_H_ | |
OLD | NEW |