OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2014 Google Inc. | 3 * Copyright 2014 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 #ifndef GrGLPathRange_DEFINED | 9 #ifndef GrGLPathRange_DEFINED |
10 #define GrGLPathRange_DEFINED | 10 #define GrGLPathRange_DEFINED |
11 | 11 |
12 #include "../GrPathRange.h" | 12 #include "../GrPathRange.h" |
| 13 #include "GrStrokeInfo.h" |
13 #include "gl/GrGLFunctions.h" | 14 #include "gl/GrGLFunctions.h" |
14 | 15 |
15 class GrGLGpu; | 16 class GrGLGpu; |
16 | 17 |
17 /** | 18 /** |
18 * Currently this represents a range of GL_NV_path_rendering Path IDs. If we | 19 * 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 * support other GL path extensions then this would have to have a type enum |
20 * and/or be subclassed. | 21 * and/or be subclassed. |
21 */ | 22 */ |
22 | 23 |
23 class GrGLPathRange : public GrPathRange { | 24 class GrGLPathRange : public GrPathRange { |
24 public: | 25 public: |
25 /** | 26 /** |
26 * Initialize a GL path range from a PathGenerator. This class will allocate | 27 * Initialize a GL path range from a PathGenerator. This class will allocate |
27 * the GPU path objects and initialize them lazily. | 28 * the GPU path objects and initialize them lazily. |
28 */ | 29 */ |
29 GrGLPathRange(GrGLGpu*, PathGenerator*, const SkStrokeRec&); | 30 GrGLPathRange(GrGLGpu*, PathGenerator*, const GrStrokeInfo&); |
30 | 31 |
31 /** | 32 /** |
32 * Initialize a GL path range from an existing range of pre-initialized GPU | 33 * Initialize a GL path range from an existing range of pre-initialized GPU |
33 * path objects. This class assumes ownership of the GPU path objects and | 34 * path objects. This class assumes ownership of the GPU path objects and |
34 * will delete them when done. | 35 * will delete them when done. |
35 */ | 36 */ |
36 GrGLPathRange(GrGLGpu*, | 37 GrGLPathRange(GrGLGpu*, |
37 GrGLuint basePathID, | 38 GrGLuint basePathID, |
38 int numPaths, | 39 int numPaths, |
39 size_t gpuMemorySize, | 40 size_t gpuMemorySize, |
40 const SkStrokeRec&); | 41 const GrStrokeInfo&); |
41 | 42 |
42 GrGLuint basePathID() const { return fBasePathID; } | 43 GrGLuint basePathID() const { return fBasePathID; } |
43 | 44 |
| 45 bool shouldStroke() const { return fShouldStroke; } |
| 46 bool shouldFill() const { return fShouldFill; } |
| 47 |
44 protected: | 48 protected: |
45 void onInitPath(int index, const SkPath&) const override; | 49 void onInitPath(int index, const SkPath&) const override; |
46 | 50 |
47 void onRelease() override; | 51 void onRelease() override; |
48 void onAbandon() override; | 52 void onAbandon() override; |
49 | 53 |
50 private: | 54 private: |
| 55 void init(); |
51 size_t onGpuMemorySize() const override { return fGpuMemorySize; } | 56 size_t onGpuMemorySize() const override { return fGpuMemorySize; } |
52 | 57 |
| 58 const GrStrokeInfo fStroke; |
53 GrGLuint fBasePathID; | 59 GrGLuint fBasePathID; |
54 mutable size_t fGpuMemorySize; | 60 mutable size_t fGpuMemorySize; |
| 61 bool fShouldStroke; |
| 62 bool fShouldFill; |
55 | 63 |
56 typedef GrPathRange INHERITED; | 64 typedef GrPathRange INHERITED; |
57 }; | 65 }; |
58 | 66 |
59 #endif | 67 #endif |
OLD | NEW |