Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | |
michael@0 | 2 | /* |
michael@0 | 3 | * Copyright 2012 Google Inc. |
michael@0 | 4 | * |
michael@0 | 5 | * Use of this source code is governed by a BSD-style license that can be |
michael@0 | 6 | * found in the LICENSE file. |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | #include "GrBufferObj.h" |
michael@0 | 10 | |
michael@0 | 11 | void GrBufferObj::allocate(GrGLsizeiptr size, const GrGLchar *dataPtr) { |
michael@0 | 12 | GrAlwaysAssert(size >= 0); |
michael@0 | 13 | |
michael@0 | 14 | // delete pre-existing data |
michael@0 | 15 | delete[] fDataPtr; |
michael@0 | 16 | |
michael@0 | 17 | fSize = size; |
michael@0 | 18 | fDataPtr = new GrGLchar[size]; |
michael@0 | 19 | if (dataPtr) { |
michael@0 | 20 | memcpy(fDataPtr, dataPtr, fSize); |
michael@0 | 21 | } |
michael@0 | 22 | // TODO: w/ no dataPtr the data is unitialized - this could be tracked |
michael@0 | 23 | } |
michael@0 | 24 | |
michael@0 | 25 | void GrBufferObj::deleteAction() { |
michael@0 | 26 | |
michael@0 | 27 | // buffers are automatically unmapped when deleted |
michael@0 | 28 | this->resetMapped(); |
michael@0 | 29 | |
michael@0 | 30 | this->INHERITED::deleteAction(); |
michael@0 | 31 | } |