blob: a4bac651c43e7db93880135d2d8fd7c181196e7d [file] [log] [blame]
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "services/ui/public/cpp/gpu_memory_buffer_impl.h"
namespace ui {
GpuMemoryBufferImpl::GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id,
const gfx::Size& size,
gfx::BufferFormat format)
: id_(id), size_(size), format_(format), mapped_(false) {}
GpuMemoryBufferImpl::~GpuMemoryBufferImpl() {
DCHECK(!mapped_);
}
// static
GpuMemoryBufferImpl* GpuMemoryBufferImpl::FromClientBuffer(
ClientBuffer buffer) {
return reinterpret_cast<GpuMemoryBufferImpl*>(buffer);
}
gfx::Size GpuMemoryBufferImpl::GetSize() const {
return size_;
}
gfx::BufferFormat GpuMemoryBufferImpl::GetFormat() const {
return format_;
}
gfx::GpuMemoryBufferId GpuMemoryBufferImpl::GetId() const {
return id_;
}
ClientBuffer GpuMemoryBufferImpl::AsClientBuffer() {
return reinterpret_cast<ClientBuffer>(this);
}
#if defined(USE_OZONE)
scoped_refptr<ui::NativePixmap> GpuMemoryBufferImpl::GetNativePixmap() {
return scoped_refptr<ui::NativePixmap>();
}
#endif
} // namespace ui