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 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" | 5 #include "content/common/gpu/client/gpu_memory_buffer_impl.h" |
6 | 6 |
7 #include "ui/gl/gl_bindings.h" | 7 #include "ui/gl/gl_bindings.h" |
8 | 8 |
9 namespace content { | 9 namespace content { |
10 | 10 |
11 GpuMemoryBufferImpl::GpuMemoryBufferImpl(gfx::Size size, | 11 GpuMemoryBufferImpl::GpuMemoryBufferImpl(gfx::Size size, |
12 unsigned internalformat) | 12 unsigned internalformat, |
13 : size_(size), internalformat_(internalformat), mapped_(false) { | 13 gfx::GpuMemoryBuffer::Usage usage) |
| 14 : size_(size), |
| 15 internalformat_(internalformat), |
| 16 usage_(usage), |
| 17 mapped_(false) { |
14 DCHECK(IsFormatValid(internalformat)); | 18 DCHECK(IsFormatValid(internalformat)); |
15 } | 19 } |
16 | 20 |
17 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() {} | 21 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() {} |
18 | 22 |
19 // static | 23 // static |
20 bool GpuMemoryBufferImpl::IsFormatValid(unsigned internalformat) { | 24 bool GpuMemoryBufferImpl::IsFormatValid(unsigned internalformat) { |
21 switch (internalformat) { | 25 switch (internalformat) { |
22 case GL_BGRA8_EXT: | 26 case GL_BGRA8_EXT: |
23 case GL_RGBA8_OES: | 27 case GL_RGBA8_OES: |
(...skipping 15 matching lines...) Expand all Loading... |
39 } | 43 } |
40 } | 44 } |
41 | 45 |
42 bool GpuMemoryBufferImpl::IsMapped() const { return mapped_; } | 46 bool GpuMemoryBufferImpl::IsMapped() const { return mapped_; } |
43 | 47 |
44 uint32 GpuMemoryBufferImpl::GetStride() const { | 48 uint32 GpuMemoryBufferImpl::GetStride() const { |
45 return size_.width() * BytesPerPixel(internalformat_); | 49 return size_.width() * BytesPerPixel(internalformat_); |
46 } | 50 } |
47 | 51 |
48 } // namespace content | 52 } // namespace content |
OLD | NEW |