| 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 |
| 11 #include "GrTextureProvider.h" | 11 #include "GrTextureProvider.h" |
| 12 #include "GrPathRange.h" |
| 12 | 13 |
| 13 class GrIndexBuffer; | 14 class GrIndexBuffer; |
| 15 class GrPath; |
| 16 class GrStrokeInfo; |
| 14 class GrVertexBuffer; | 17 class GrVertexBuffer; |
| 18 class SkDescriptor; |
| 19 class SkPath; |
| 20 class SkTypeface; |
| 15 | 21 |
| 16 /** | 22 /** |
| 17 * An extension of the texture provider for arbitrary resource types. This class
is intended for | 23 * An extension of the texture provider for arbitrary resource types. This class
is intended for |
| 18 * use within the Gr code base, not by clients or extensions (e.g. third party G
rProcessor | 24 * use within the Gr code base, not by clients or extensions (e.g. third party G
rProcessor |
| 19 * derivatives). | 25 * derivatives). |
| 20 */ | 26 */ |
| 21 class GrResourceProvider : public GrTextureProvider { | 27 class GrResourceProvider : public GrTextureProvider { |
| 22 public: | 28 public: |
| 23 | 29 |
| 24 GrResourceProvider(GrGpu* gpu, GrResourceCache* cache); | 30 GrResourceProvider(GrGpu* gpu, GrResourceCache* cache); |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 * @ return the quad index buffer | 65 * @ return the quad index buffer |
| 60 */ | 66 */ |
| 61 const GrIndexBuffer* refQuadIndexBuffer() { | 67 const GrIndexBuffer* refQuadIndexBuffer() { |
| 62 if (GrIndexBuffer* buffer = | 68 if (GrIndexBuffer* buffer = |
| 63 this->findAndRefTByUniqueKey<GrIndexBuffer>(fQuadIndexBufferKey)) { | 69 this->findAndRefTByUniqueKey<GrIndexBuffer>(fQuadIndexBufferKey)) { |
| 64 return buffer; | 70 return buffer; |
| 65 } | 71 } |
| 66 return this->createQuadIndexBuffer(); | 72 return this->createQuadIndexBuffer(); |
| 67 } | 73 } |
| 68 | 74 |
| 75 /** |
| 76 * Factories for GrPath and GrPathRange objects. It's an error to call these
if path rendering |
| 77 * is not supported. |
| 78 */ |
| 79 GrPath* createPath(const SkPath&, const GrStrokeInfo&); |
| 80 GrPathRange* createPathRange(GrPathRange::PathGenerator*, const GrStrokeInfo
&); |
| 81 GrPathRange* createGlyphs(const SkTypeface*, const SkDescriptor*, const GrSt
rokeInfo&); |
| 82 |
| 69 | 83 |
| 70 using GrTextureProvider::assignUniqueKeyToResource; | 84 using GrTextureProvider::assignUniqueKeyToResource; |
| 71 using GrTextureProvider::findAndRefResourceByUniqueKey; | 85 using GrTextureProvider::findAndRefResourceByUniqueKey; |
| 72 using GrTextureProvider::abandon; | 86 using GrTextureProvider::abandon; |
| 73 | 87 |
| 74 private: | 88 private: |
| 75 const GrIndexBuffer* createInstancedIndexBuffer(const uint16_t* pattern, | 89 const GrIndexBuffer* createInstancedIndexBuffer(const uint16_t* pattern, |
| 76 int patternSize, | 90 int patternSize, |
| 77 int reps, | 91 int reps, |
| 78 int vertCount, | 92 int vertCount, |
| 79 const GrUniqueKey& key); | 93 const GrUniqueKey& key); |
| 80 | 94 |
| 81 const GrIndexBuffer* createQuadIndexBuffer(); | 95 const GrIndexBuffer* createQuadIndexBuffer(); |
| 82 | 96 |
| 83 GrUniqueKey fQuadIndexBufferKey; | 97 GrUniqueKey fQuadIndexBufferKey; |
| 84 | 98 |
| 85 typedef GrTextureProvider INHERITED; | 99 typedef GrTextureProvider INHERITED; |
| 86 }; | 100 }; |
| 87 | 101 |
| 88 #endif | 102 #endif |
| OLD | NEW |