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