OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_H_ | 5 #ifndef CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 6 #define CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "ui/gfx/gpu_memory_buffer.h" | 9 #include "ui/gfx/gpu_memory_buffer.h" |
10 #include "ui/gfx/size.h" | 10 #include "ui/gfx/size.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 // Provides common implementation of a GPU memory buffer based | 14 // Provides common implementation of a GPU memory buffer. |
15 // on a shared memory handle. | |
16 class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { | 15 class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { |
17 public: | 16 public: |
18 GpuMemoryBufferImpl(scoped_ptr<base::SharedMemory> shared_memory, | 17 static scoped_ptr<GpuMemoryBufferImpl> Create( |
19 size_t width, | 18 gfx::GpuMemoryBufferHandle handle, |
20 size_t height, | 19 gfx::Size size, |
21 unsigned internalformat); | 20 unsigned internalformat); |
21 | |
22 virtual ~GpuMemoryBufferImpl(); | 22 virtual ~GpuMemoryBufferImpl(); |
23 | 23 |
24 // Overridden from gfx::GpuMemoryBuffer: | |
25 virtual void Map(AccessMode mode, void** vaddr) OVERRIDE; | |
26 virtual void Unmap() OVERRIDE; | |
27 virtual bool IsMapped() const OVERRIDE; | |
28 virtual uint32 GetStride() const OVERRIDE; | |
29 virtual gfx::GpuMemoryBufferHandle GetHandle() const OVERRIDE; | |
30 | |
31 static bool IsFormatValid(unsigned internalformat); | 24 static bool IsFormatValid(unsigned internalformat); |
piman
2013/12/03 02:59:51
This gets hidden by the GpuMemoryBufferImplIOSurfa
reveman
2013/12/03 17:58:32
I think this belongs in GpuMemoryBufferImpl as it'
| |
32 static size_t BytesPerPixel(unsigned internalformat); | 25 static size_t BytesPerPixel(unsigned internalformat); |
33 | 26 |
34 private: | 27 // Overridden from gfx::GpuMemoryBuffer: |
35 scoped_ptr<base::SharedMemory> shared_memory_; | 28 virtual bool IsMapped() const OVERRIDE; |
29 virtual uint32 GetStride() const OVERRIDE; | |
30 | |
31 protected: | |
32 GpuMemoryBufferImpl(gfx::Size size, unsigned internalformat); | |
33 | |
36 const gfx::Size size_; | 34 const gfx::Size size_; |
37 unsigned internalformat_; | 35 unsigned internalformat_; |
38 bool mapped_; | 36 bool mapped_; |
39 | |
40 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); | |
piman
2013/12/03 02:59:51
nit: keep
reveman
2013/12/03 17:58:32
Done.
| |
41 }; | 37 }; |
42 | 38 |
43 } // namespace content | 39 } // namespace content |
44 | 40 |
45 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ | 41 #endif // CONTENT_COMMON_GPU_CLIENT_GPU_MEMORY_BUFFER_IMPL_H_ |
OLD | NEW |