aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/gl/GrGLPath.h
blob: ddcee533ee6b831bea448053ac8458e1cdafc789 (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
49
50
51
52
53
54
55
56
/*
 * Copyright 2012 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef GrGLPath_DEFINED
#define GrGLPath_DEFINED

#include "../GrPath.h"
#include "gl/GrGLTypes.h"

class GrGLGpu;
class GrStyle;

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

class GrGLPath : public GrPath {
public:
    static bool InitPathObjectPathDataCheckingDegenerates(GrGLGpu*,
                                                          GrGLuint pathID,
                                                          const SkPath&);
    static void InitPathObjectPathData(GrGLGpu*,
                                       GrGLuint pathID,
                                       const SkPath&);
    static void InitPathObjectStroke(GrGLGpu*, GrGLuint pathID, const SkStrokeRec&);

    static void InitPathObjectEmptyPath(GrGLGpu*, GrGLuint pathID);


    GrGLPath(GrGLGpu*, const SkPath&, const GrStyle&);
    GrGLuint pathID() const { return fPathID; }

    bool shouldStroke() const { return fShouldStroke; }
    bool shouldFill() const { return fShouldFill; }
protected:
    void onRelease() override;
    void onAbandon() override;

private:
    // TODO: Figure out how to get an approximate size of the path in Gpu memory.
    size_t onGpuMemorySize() const override { return 100; }

    GrGLuint fPathID;
    bool fShouldStroke;
    bool fShouldFill;

    typedef GrPath INHERITED;
};

#endif