blob: 927310d651e004424b0f3d23b46d0c264a152e00 [file] [log] [blame]
cdaltonb85a0aa2014-07-21 15:32:44 -07001
2/*
3 * Copyright 2014 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.
7 */
8
9#ifndef GrGLPathRange_DEFINED
10#define GrGLPathRange_DEFINED
11
12#include "../GrPathRange.h"
13#include "gl/GrGLFunctions.h"
14
15class GrGpuGL;
16
17/**
18 * Currently this represents a range of GL_NV_path_rendering Path IDs. If we
19 * support other GL path extensions then this would have to have a type enum
20 * and/or be subclassed.
21 */
22
23class GrGLPathRange : public GrPathRange {
24public:
cdaltonc7103a12014-08-11 14:05:05 -070025 GrGLPathRange(GrGpuGL*, size_t size, const SkStrokeRec&);
cdaltonb85a0aa2014-07-21 15:32:44 -070026 virtual ~GrGLPathRange();
27
28 GrGLuint basePathID() const { return fBasePathID; }
bungemanaf13c7c2014-08-06 11:14:31 -040029
cdaltonb85a0aa2014-07-21 15:32:44 -070030 virtual void initAt(size_t index, const SkPath&);
bungemanaf13c7c2014-08-06 11:14:31 -040031
32 // TODO: Use a better approximation for the individual path sizes.
33 virtual size_t gpuMemorySize() const SK_OVERRIDE {
34 return 100 * fNumDefinedPaths;
35 }
cdaltonb85a0aa2014-07-21 15:32:44 -070036
37protected:
38 virtual void onRelease() SK_OVERRIDE;
39 virtual void onAbandon() SK_OVERRIDE;
40
41private:
42 GrGLuint fBasePathID;
bungemanaf13c7c2014-08-06 11:14:31 -040043 size_t fNumDefinedPaths;
cdaltonb85a0aa2014-07-21 15:32:44 -070044
45 typedef GrPathRange INHERITED;
46};
47
48#endif