| 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 "GrBatchAtlas.h" | 11 #include "GrBatchAtlas.h" |
| 12 #include "GrIndexBuffer.h" | 12 #include "GrIndexBuffer.h" |
| 13 #include "GrTextureProvider.h" | 13 #include "GrTextureProvider.h" |
| 14 #include "GrPathRange.h" | 14 #include "GrPathRange.h" |
| 15 | 15 |
| 16 class GrBatchAtlas; | 16 class GrBatchAtlas; |
| 17 class GrIndexBuffer; | 17 class GrIndexBuffer; |
| 18 class GrPath; | 18 class GrPath; |
| 19 class GrRenderTarget; | 19 class GrRenderTarget; |
| 20 class GrSingleOwner; |
| 20 class GrStencilAttachment; | 21 class GrStencilAttachment; |
| 21 class GrStrokeInfo; | 22 class GrStrokeInfo; |
| 22 class GrVertexBuffer; | 23 class GrVertexBuffer; |
| 23 class SkDescriptor; | 24 class SkDescriptor; |
| 24 class SkPath; | 25 class SkPath; |
| 25 class SkTypeface; | 26 class SkTypeface; |
| 26 | 27 |
| 27 /** | 28 /** |
| 28 * An extension of the texture provider for arbitrary resource types. This class
is intended for | 29 * An extension of the texture provider for arbitrary resource types. This class
is intended for |
| 29 * use within the Gr code base, not by clients or extensions (e.g. third party G
rProcessor | 30 * use within the Gr code base, not by clients or extensions (e.g. third party G
rProcessor |
| 30 * derivatives). | 31 * derivatives). |
| 31 * | 32 * |
| 32 * This currently inherits from GrTextureProvider non-publically to force caller
s to provider | 33 * This currently inherits from GrTextureProvider non-publically to force caller
s to provider |
| 33 * make a flags (pendingIO) decision and not use the GrTP methods that don't tak
e flags. This | 34 * make a flags (pendingIO) decision and not use the GrTP methods that don't tak
e flags. This |
| 34 * can be relaxed once https://bug.skia.org/4156 is fixed. | 35 * can be relaxed once https://bug.skia.org/4156 is fixed. |
| 35 */ | 36 */ |
| 36 class GrResourceProvider : protected GrTextureProvider { | 37 class GrResourceProvider : protected GrTextureProvider { |
| 37 public: | 38 public: |
| 38 GrResourceProvider(GrGpu* gpu, GrResourceCache* cache); | 39 GrResourceProvider(GrGpu* gpu, GrResourceCache* cache, GrSingleOwner* owner)
; |
| 39 | 40 |
| 40 template <typename T> T* findAndRefTByUniqueKey(const GrUniqueKey& key) { | 41 template <typename T> T* findAndRefTByUniqueKey(const GrUniqueKey& key) { |
| 41 return static_cast<T*>(this->findAndRefResourceByUniqueKey(key)); | 42 return static_cast<T*>(this->findAndRefResourceByUniqueKey(key)); |
| 42 } | 43 } |
| 43 | 44 |
| 44 /** | 45 /** |
| 45 * Either finds and refs, or creates an index buffer for instanced drawing w
ith a specific | 46 * Either finds and refs, or creates an index buffer for instanced drawing w
ith a specific |
| 46 * pattern if the index buffer is not found. If the return is non-null, the
caller owns | 47 * pattern if the index buffer is not found. If the return is non-null, the
caller owns |
| 47 * a ref on the returned GrIndexBuffer. | 48 * a ref on the returned GrIndexBuffer. |
| 48 * | 49 * |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 const GrUniqueKey& key); | 155 const GrUniqueKey& key); |
| 155 | 156 |
| 156 const GrIndexBuffer* createQuadIndexBuffer(); | 157 const GrIndexBuffer* createQuadIndexBuffer(); |
| 157 | 158 |
| 158 GrUniqueKey fQuadIndexBufferKey; | 159 GrUniqueKey fQuadIndexBufferKey; |
| 159 | 160 |
| 160 typedef GrTextureProvider INHERITED; | 161 typedef GrTextureProvider INHERITED; |
| 161 }; | 162 }; |
| 162 | 163 |
| 163 #endif | 164 #endif |
| OLD | NEW |