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.
5 #include "content/common/gpu/client/gpu_memory_buffer_impl.h"
7 #include "ui/gl/gl_bindings.h"
11 GpuMemoryBufferImpl::GpuMemoryBufferImpl(const gfx::Size& size,
12 unsigned internalformat,
13 const DestructionCallback& callback)
15 internalformat_(internalformat),
18 DCHECK(IsFormatValid(internalformat));
21 GpuMemoryBufferImpl::~GpuMemoryBufferImpl() {
26 bool GpuMemoryBufferImpl::IsFormatValid(unsigned internalformat) {
27 switch (internalformat) {
38 bool GpuMemoryBufferImpl::IsUsageValid(unsigned usage) {
40 case GL_IMAGE_MAP_CHROMIUM:
41 case GL_IMAGE_SCANOUT_CHROMIUM:
49 size_t GpuMemoryBufferImpl::BytesPerPixel(unsigned internalformat) {
50 switch (internalformat) {
61 bool GpuMemoryBufferImpl::IsMapped() const { return mapped_; }
63 } // namespace content