1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/gpu/gl/GrGLIndexBuffer.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,57 @@ 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 "GrGLIndexBuffer.h" 1.12 +#include "GrGpuGL.h" 1.13 + 1.14 +GrGLIndexBuffer::GrGLIndexBuffer(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_ELEMENT_ARRAY_BUFFER) { 1.17 +} 1.18 + 1.19 +void GrGLIndexBuffer::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 +void GrGLIndexBuffer::onAbandon() { 1.28 + fImpl.abandon(); 1.29 + INHERITED::onAbandon(); 1.30 +} 1.31 + 1.32 +void* GrGLIndexBuffer::lock() { 1.33 + if (this->isValid()) { 1.34 + return fImpl.lock(this->getGpuGL()); 1.35 + } else { 1.36 + return NULL; 1.37 + } 1.38 +} 1.39 + 1.40 +void* GrGLIndexBuffer::lockPtr() const { 1.41 + return fImpl.lockPtr(); 1.42 +} 1.43 + 1.44 +void GrGLIndexBuffer::unlock() { 1.45 + if (this->isValid()) { 1.46 + fImpl.unlock(this->getGpuGL()); 1.47 + } 1.48 +} 1.49 + 1.50 +bool GrGLIndexBuffer::isLocked() const { 1.51 + return fImpl.isLocked(); 1.52 +} 1.53 + 1.54 +bool GrGLIndexBuffer::updateData(const void* src, size_t srcSizeInBytes) { 1.55 + if (this->isValid()) { 1.56 + return fImpl.updateData(this->getGpuGL(), src, srcSizeInBytes); 1.57 + } else { 1.58 + return false; 1.59 + } 1.60 +}