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 "GrGLIndexBuffer.h"
11 GrGLIndexBuffer::GrGLIndexBuffer(GrGpuGL* gpu, const Desc& desc)
12 : INHERITED(gpu, desc.fIsWrapped, desc.fSizeInBytes, desc.fDynamic, 0 == desc.fID)
13 , fImpl(gpu, desc, GR_GL_ELEMENT_ARRAY_BUFFER) {
14 this->registerWithCache();
17 void GrGLIndexBuffer::onRelease() {
18 if (!this->wasDestroyed()) {
19 fImpl.release(this->getGpuGL());
22 INHERITED::onRelease();
25 void GrGLIndexBuffer::onAbandon() {
27 INHERITED::onAbandon();
30 void* GrGLIndexBuffer::onMap() {
31 if (!this->wasDestroyed()) {
32 return fImpl.map(this->getGpuGL());
38 void GrGLIndexBuffer::onUnmap() {
39 if (!this->wasDestroyed()) {
40 fImpl.unmap(this->getGpuGL());
44 bool GrGLIndexBuffer::onUpdateData(const void* src, size_t srcSizeInBytes) {
45 if (!this->wasDestroyed()) {
46 return fImpl.updateData(this->getGpuGL(), src, srcSizeInBytes);