aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLPathRange.h
blob: 927310d651e004424b0f3d23b46d0c264a152e00 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48

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

#ifndef GrGLPathRange_DEFINED
#define GrGLPathRange_DEFINED

#include "../GrPathRange.h"
#include "gl/GrGLFunctions.h"

class GrGpuGL;

/**
 * Currently this represents a range of GL_NV_path_rendering Path IDs. If we
 * support other GL path extensions then this would have to have a type enum
 * and/or be subclassed.
 */

class GrGLPathRange : public GrPathRange {
public:
    GrGLPathRange(GrGpuGL*, size_t size, const SkStrokeRec&);
    virtual ~GrGLPathRange();

    GrGLuint basePathID() const { return fBasePathID; }

    virtual void initAt(size_t index, const SkPath&);

    // TODO: Use a better approximation for the individual path sizes.
    virtual size_t gpuMemorySize() const SK_OVERRIDE {
        return 100 * fNumDefinedPaths;
    }

protected:
    virtual void onRelease() SK_OVERRIDE;
    virtual void onAbandon() SK_OVERRIDE;

private:
    GrGLuint fBasePathID;
    size_t fNumDefinedPaths;

    typedef GrPathRange INHERITED;
};

#endif