OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 GrResourceProvider_DEFINED | 8 #ifndef GrResourceProvider_DEFINED |
9 #define GrResourceProvider_DEFINED | 9 #define GrResourceProvider_DEFINED |
10 | 10 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 * Either finds and refs, or creates an index buffer for instanced drawing w
ith a specific | 43 * Either finds and refs, or creates an index buffer for instanced drawing w
ith a specific |
44 * pattern if the index buffer is not found. If the return is non-null, the
caller owns | 44 * pattern if the index buffer is not found. If the return is non-null, the
caller owns |
45 * a ref on the returned GrIndexBuffer. | 45 * a ref on the returned GrIndexBuffer. |
46 * | 46 * |
47 * @param pattern the pattern of indices to repeat | 47 * @param pattern the pattern of indices to repeat |
48 * @param patternSize size in bytes of the pattern | 48 * @param patternSize size in bytes of the pattern |
49 * @param reps number of times to repeat the pattern | 49 * @param reps number of times to repeat the pattern |
50 * @param vertCount number of vertices the pattern references | 50 * @param vertCount number of vertices the pattern references |
51 * @param key Key to be assigned to the index buffer. | 51 * @param key Key to be assigned to the index buffer. |
52 * | 52 * |
53 * @return The index buffer if successful, otherwise NULL. | 53 * @return The index buffer if successful, otherwise nullptr. |
54 */ | 54 */ |
55 const GrIndexBuffer* findOrCreateInstancedIndexBuffer(const uint16_t* patter
n, | 55 const GrIndexBuffer* findOrCreateInstancedIndexBuffer(const uint16_t* patter
n, |
56 int patternSize, | 56 int patternSize, |
57 int reps, | 57 int reps, |
58 int vertCount, | 58 int vertCount, |
59 const GrUniqueKey& key
) { | 59 const GrUniqueKey& key
) { |
60 if (GrIndexBuffer* buffer = this->findAndRefTByUniqueKey<GrIndexBuffer>(
key)) { | 60 if (GrIndexBuffer* buffer = this->findAndRefTByUniqueKey<GrIndexBuffer>(
key)) { |
61 return buffer; | 61 return buffer; |
62 } | 62 } |
63 return this->createInstancedIndexBuffer(pattern, patternSize, reps, vert
Count, key); | 63 return this->createInstancedIndexBuffer(pattern, patternSize, reps, vert
Count, key); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 * @param height height in pixels of the atlas | 122 * @param height height in pixels of the atlas |
123 * @param numPlotsX The number of plots the atlas should be broken
up into in the X | 123 * @param numPlotsX The number of plots the atlas should be broken
up into in the X |
124 * direction | 124 * direction |
125 * @param numPlotsY The number of plots the atlas should be broken
up into in the Y | 125 * @param numPlotsY The number of plots the atlas should be broken
up into in the Y |
126 * direction | 126 * direction |
127 * @param func An eviction function which will be called whene
ver the atlas has to | 127 * @param func An eviction function which will be called whene
ver the atlas has to |
128 * evict data | 128 * evict data |
129 * @param data User supplied data which will be passed into fu
nc whenver an | 129 * @param data User supplied data which will be passed into fu
nc whenver an |
130 * eviction occurs | 130 * eviction occurs |
131 * | 131 * |
132 * @return An initialized GrBatchAtlas, or NULL if creatio
n fails | 132 * @return An initialized GrBatchAtlas, or nullptr if crea
tion fails |
133 */ | 133 */ |
134 GrBatchAtlas* createAtlas(GrPixelConfig, int width, int height, int numPlots
X, int numPlotsY, | 134 GrBatchAtlas* createAtlas(GrPixelConfig, int width, int height, int numPlots
X, int numPlotsY, |
135 GrBatchAtlas::EvictionFunc func, void* data); | 135 GrBatchAtlas::EvictionFunc func, void* data); |
136 | 136 |
137 private: | 137 private: |
138 const GrIndexBuffer* createInstancedIndexBuffer(const uint16_t* pattern, | 138 const GrIndexBuffer* createInstancedIndexBuffer(const uint16_t* pattern, |
139 int patternSize, | 139 int patternSize, |
140 int reps, | 140 int reps, |
141 int vertCount, | 141 int vertCount, |
142 const GrUniqueKey& key); | 142 const GrUniqueKey& key); |
143 | 143 |
144 const GrIndexBuffer* createQuadIndexBuffer(); | 144 const GrIndexBuffer* createQuadIndexBuffer(); |
145 | 145 |
146 GrUniqueKey fQuadIndexBufferKey; | 146 GrUniqueKey fQuadIndexBufferKey; |
147 | 147 |
148 typedef GrTextureProvider INHERITED; | 148 typedef GrTextureProvider INHERITED; |
149 }; | 149 }; |
150 | 150 |
151 #endif | 151 #endif |
OLD | NEW |