blob: 6e556d2b83ef632f3cb24408fcb806fed7ffd9bb [file] [log] [blame]
epoger@google.comec3ed6a2011-07-28 14:26:00 +00001
reed@google.comac10a2d2010-12-22 21:39:39 +00002/*
epoger@google.comec3ed6a2011-07-28 14:26:00 +00003 * 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.
reed@google.comac10a2d2010-12-22 21:39:39 +00007 */
8
9
epoger@google.comec3ed6a2011-07-28 14:26:00 +000010
reed@google.comac10a2d2010-12-22 21:39:39 +000011#ifndef GrIndexBuffer_DEFINED
12#define GrIndexBuffer_DEFINED
13
bsalomon@google.com1c13c962011-02-14 16:51:21 +000014#include "GrGeometryBuffer.h"
reed@google.comac10a2d2010-12-22 21:39:39 +000015
bsalomon@google.com1c13c962011-02-14 16:51:21 +000016class GrIndexBuffer : public GrGeometryBuffer {
bsalomon@google.com86afc2a2011-02-16 16:12:19 +000017public:
bsalomon@google.com72830222013-01-23 20:25:22 +000018 /**
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 this->sizeInBytes() / (sizeof(uint16_t) * 6);
25 }
reed@google.comac10a2d2010-12-22 21:39:39 +000026protected:
bsalomon@google.com72830222013-01-23 20:25:22 +000027 GrIndexBuffer(GrGpu* gpu, bool isWrapped, size_t sizeInBytes, bool dynamic)
28 : INHERITED(gpu, isWrapped, sizeInBytes, dynamic) {}
reed@google.comac10a2d2010-12-22 21:39:39 +000029private:
bsalomon@google.com1c13c962011-02-14 16:51:21 +000030 typedef GrGeometryBuffer INHERITED;
reed@google.comac10a2d2010-12-22 21:39:39 +000031};
32
33#endif