Home | History | Annotate | Download | only in gpu
      1 
      2 /*
      3  * Copyright 2010 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 GrIndexBuffer_DEFINED
     12 #define GrIndexBuffer_DEFINED
     13 
     14 #include "GrGeometryBuffer.h"
     15 
     16 class GrIndexBuffer : public GrGeometryBuffer {
     17 public:
     18     /**
     19      * Retrieves the maximum number of quads that could be rendered
     20      * from the index buffer (using kTriangles_GrPrimitiveType).
     21      * @return the maximum number of quads using full size of index buffer.
     22      */
     23     int maxQuads() const {
     24         return static_cast<int>(this->gpuMemorySize() / (sizeof(uint16_t) * 6));
     25     }
     26 protected:
     27     GrIndexBuffer(GrGpu* gpu, size_t gpuMemorySize, bool dynamic, bool cpuBacked)
     28         : INHERITED(gpu, gpuMemorySize, dynamic, cpuBacked) {}
     29 private:
     30     typedef GrGeometryBuffer INHERITED;
     31 };
     32 
     33 #endif
     34