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