1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/gfx/skia/trunk/src/gpu/gl/debug/GrBufferObj.cpp Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,31 @@ 1.4 + 1.5 +/* 1.6 + * Copyright 2012 Google Inc. 1.7 + * 1.8 + * Use of this source code is governed by a BSD-style license that can be 1.9 + * found in the LICENSE file. 1.10 + */ 1.11 + 1.12 +#include "GrBufferObj.h" 1.13 + 1.14 +void GrBufferObj::allocate(GrGLsizeiptr size, const GrGLchar *dataPtr) { 1.15 + GrAlwaysAssert(size >= 0); 1.16 + 1.17 + // delete pre-existing data 1.18 + delete[] fDataPtr; 1.19 + 1.20 + fSize = size; 1.21 + fDataPtr = new GrGLchar[size]; 1.22 + if (dataPtr) { 1.23 + memcpy(fDataPtr, dataPtr, fSize); 1.24 + } 1.25 + // TODO: w/ no dataPtr the data is unitialized - this could be tracked 1.26 +} 1.27 + 1.28 +void GrBufferObj::deleteAction() { 1.29 + 1.30 + // buffers are automatically unmapped when deleted 1.31 + this->resetMapped(); 1.32 + 1.33 + this->INHERITED::deleteAction(); 1.34 +}