michael@0: michael@0: /* michael@0: * Copyright 2010 Google Inc. michael@0: * michael@0: * Use of this source code is governed by a BSD-style license that can be michael@0: * found in the LICENSE file. michael@0: */ michael@0: michael@0: michael@0: michael@0: #ifndef GrIndexBuffer_DEFINED michael@0: #define GrIndexBuffer_DEFINED michael@0: michael@0: #include "GrGeometryBuffer.h" michael@0: michael@0: class GrIndexBuffer : public GrGeometryBuffer { michael@0: public: michael@0: /** michael@0: * Retrieves the maximum number of quads that could be rendered michael@0: * from the index buffer (using kTriangles_GrPrimitiveType). michael@0: * @return the maximum number of quads using full size of index buffer. michael@0: */ michael@0: int maxQuads() const { michael@0: return static_cast(this->sizeInBytes() / (sizeof(uint16_t) * 6)); michael@0: } michael@0: protected: michael@0: GrIndexBuffer(GrGpu* gpu, bool isWrapped, size_t sizeInBytes, bool dynamic, bool cpuBacked) michael@0: : INHERITED(gpu, isWrapped, sizeInBytes, dynamic, cpuBacked) {} michael@0: private: michael@0: typedef GrGeometryBuffer INHERITED; michael@0: }; michael@0: michael@0: #endif