Home | History | Annotate | Download | only in gl
      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 GrGLIndexBuffer_DEFINED
     11 #define GrGLIndexBuffer_DEFINED
     12 
     13 #include "GrIndexBuffer.h"
     14 #include "gl/GrGLInterface.h"
     15 
     16 class GrGpuGL;
     17 
     18 class GrGLIndexBuffer : public GrIndexBuffer {
     19 
     20 public:
     21 
     22     virtual ~GrGLIndexBuffer() { this->release(); }
     23 
     24     GrGLuint bufferID() const;
     25 
     26     // overrides of GrIndexBuffer
     27     virtual void* lock();
     28     virtual void* lockPtr() const;
     29     virtual void unlock();
     30     virtual bool isLocked() const;
     31     virtual bool updateData(const void* src, size_t srcSizeInBytes);
     32 
     33 protected:
     34     GrGLIndexBuffer(GrGpuGL* gpu,
     35                     bool isWrapped,
     36                     GrGLuint id,
     37                     size_t sizeInBytes,
     38                     bool dynamic);
     39 
     40     // overrides of GrResource
     41     virtual void onAbandon() SK_OVERRIDE;
     42     virtual void onRelease() SK_OVERRIDE;
     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