1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/gpu/gl/GrGLVertexBuffer.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,58 @@ 1.4 +/* 1.5 + * Copyright 2011 Google Inc. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license that can be 1.8 + * found in the LICENSE file. 1.9 + */ 1.10 + 1.11 +#include "GrGLVertexBuffer.h" 1.12 +#include "GrGpuGL.h" 1.13 + 1.14 +GrGLVertexBuffer::GrGLVertexBuffer(GrGpuGL* gpu, const Desc& desc) 1.15 + : INHERITED(gpu, desc.fIsWrapped, desc.fSizeInBytes, desc.fDynamic, 0 == desc.fID) 1.16 + , fImpl(gpu, desc, GR_GL_ARRAY_BUFFER) { 1.17 +} 1.18 + 1.19 +void GrGLVertexBuffer::onRelease() { 1.20 + if (this->isValid()) { 1.21 + fImpl.release(this->getGpuGL()); 1.22 + } 1.23 + 1.24 + INHERITED::onRelease(); 1.25 +} 1.26 + 1.27 + 1.28 +void GrGLVertexBuffer::onAbandon() { 1.29 + fImpl.abandon(); 1.30 + INHERITED::onAbandon(); 1.31 +} 1.32 + 1.33 +void* GrGLVertexBuffer::lock() { 1.34 + if (this->isValid()) { 1.35 + return fImpl.lock(this->getGpuGL()); 1.36 + } else { 1.37 + return NULL; 1.38 + } 1.39 +} 1.40 + 1.41 +void* GrGLVertexBuffer::lockPtr() const { 1.42 + return fImpl.lockPtr(); 1.43 +} 1.44 + 1.45 +void GrGLVertexBuffer::unlock() { 1.46 + if (this->isValid()) { 1.47 + fImpl.unlock(this->getGpuGL()); 1.48 + } 1.49 +} 1.50 + 1.51 +bool GrGLVertexBuffer::isLocked() const { 1.52 + return fImpl.isLocked(); 1.53 +} 1.54 + 1.55 +bool GrGLVertexBuffer::updateData(const void* src, size_t srcSizeInBytes) { 1.56 + if (this->isValid()) { 1.57 + return fImpl.updateData(this->getGpuGL(), src, srcSizeInBytes); 1.58 + } else { 1.59 + return false; 1.60 + } 1.61 +}