1 /* 2 * Copyright 2011 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 9 10 #ifndef GrGLVertexBuffer_DEFINED 11 #define GrGLVertexBuffer_DEFINED 12 13 #include "GrVertexBuffer.h" 14 #include "gl/GrGLInterface.h" 15 16 class GrGpuGL; 17 18 class GrGLVertexBuffer : public GrVertexBuffer { 19 20 public: 21 virtual ~GrGLVertexBuffer() { this->release(); } 22 // overrides of GrVertexBuffer 23 virtual void* lock(); 24 virtual void* lockPtr() const; 25 virtual void unlock(); 26 virtual bool isLocked() const; 27 virtual bool updateData(const void* src, size_t srcSizeInBytes); 28 GrGLuint bufferID() const; 29 30 protected: 31 GrGLVertexBuffer(GrGpuGL* gpu, 32 bool isWrapped, 33 GrGLuint id, 34 size_t sizeInBytes, 35 bool dynamic); 36 37 // overrides of GrResource 38 virtual void onAbandon() SK_OVERRIDE; 39 virtual void onRelease() SK_OVERRIDE; 40 41 private: 42 void bind() const; 43 44 GrGLuint fBufferID; 45 void* fLockPtr; 46 47 friend class GrGpuGL; 48 49 typedef GrVertexBuffer INHERITED; 50 }; 51 52 #endif 53