blob: 113b89d3070557540aa63a5a2173997a5e458f04 [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 {
commit-bot@chromium.org089a7802014-05-02 21:38:22 +000024 return static_cast<int>(this->gpuMemorySize() / (sizeof(uint16_t) * 6));
bsalomon@google.com72830222013-01-23 20:25:22 +000025 }
reed@google.comac10a2d2010-12-22 21:39:39 +000026protected:
commit-bot@chromium.org089a7802014-05-02 21:38:22 +000027 GrIndexBuffer(GrGpu* gpu, bool isWrapped, size_t gpuMemorySize, bool dynamic, bool cpuBacked)
28 : INHERITED(gpu, isWrapped, gpuMemorySize, dynamic, cpuBacked) {}
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