2 * Copyright 2011 Google Inc.
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
8 #include "GrGLVertexBuffer.h"
11 GrGLVertexBuffer::GrGLVertexBuffer(GrGpuGL* gpu, const Desc& desc)
12 : INHERITED(gpu, desc.fIsWrapped, desc.fSizeInBytes, desc.fDynamic, 0 == desc.fID)
13 , fImpl(gpu, desc, GR_GL_ARRAY_BUFFER) {
16 void GrGLVertexBuffer::onRelease() {
17 if (!this->wasDestroyed()) {
18 fImpl.release(this->getGpuGL());
21 INHERITED::onRelease();
25 void GrGLVertexBuffer::onAbandon() {
27 INHERITED::onAbandon();
30 void* GrGLVertexBuffer::lock() {
31 if (!this->wasDestroyed()) {
32 return fImpl.lock(this->getGpuGL());
38 void* GrGLVertexBuffer::lockPtr() const {
39 return fImpl.lockPtr();
42 void GrGLVertexBuffer::unlock() {
43 if (!this->wasDestroyed()) {
44 fImpl.unlock(this->getGpuGL());
48 bool GrGLVertexBuffer::isLocked() const {
49 return fImpl.isLocked();
52 bool GrGLVertexBuffer::updateData(const void* src, size_t srcSizeInBytes) {
53 if (!this->wasDestroyed()) {
54 return fImpl.updateData(this->getGpuGL(), src, srcSizeInBytes);