michael@0: michael@0: /* michael@0: * Copyright 2012 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: #include "GrBufferObj.h" michael@0: michael@0: void GrBufferObj::allocate(GrGLsizeiptr size, const GrGLchar *dataPtr) { michael@0: GrAlwaysAssert(size >= 0); michael@0: michael@0: // delete pre-existing data michael@0: delete[] fDataPtr; michael@0: michael@0: fSize = size; michael@0: fDataPtr = new GrGLchar[size]; michael@0: if (dataPtr) { michael@0: memcpy(fDataPtr, dataPtr, fSize); michael@0: } michael@0: // TODO: w/ no dataPtr the data is unitialized - this could be tracked michael@0: } michael@0: michael@0: void GrBufferObj::deleteAction() { michael@0: michael@0: // buffers are automatically unmapped when deleted michael@0: this->resetMapped(); michael@0: michael@0: this->INHERITED::deleteAction(); michael@0: }