aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/GrIndexBuffer.h
blob: 69ee86f769d24fa2a88c897a5a2c27f72644ff3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33

/*
 * Copyright 2010 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */



#ifndef GrIndexBuffer_DEFINED
#define GrIndexBuffer_DEFINED

#include "GrGeometryBuffer.h"

class GrIndexBuffer : public GrGeometryBuffer {
public:
    /**
     * Retrieves the maximum number of quads that could be rendered
     * from the index buffer (using kTriangles_GrPrimitiveType).
     * @return the maximum number of quads using full size of index buffer.
     */
    int maxQuads() const {
        return this->sizeInBytes() / (sizeof(uint16_t) * 6);
    }
protected:
    GrIndexBuffer(GrGpu* gpu, bool isWrapped, size_t sizeInBytes, bool dynamic, bool cpuBacked)
        : INHERITED(gpu, isWrapped, sizeInBytes, dynamic, cpuBacked) {}
private:
    typedef GrGeometryBuffer INHERITED;
};

#endif