| 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 13 matching lines...) Expand all Loading... |
| 24 class SkPath; | 24 class SkPath; |
| 25 class SkTypeface; | 25 class SkTypeface; |
| 26 | 26 |
| 27 /** | 27 /** |
| 28 * An extension of the texture provider for arbitrary resource types. This class
is intended for | 28 * 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 | 29 * use within the Gr code base, not by clients or extensions (e.g. third party G
rProcessor |
| 30 * derivatives). | 30 * derivatives). |
| 31 * | 31 * |
| 32 * This currently inherits from GrTextureProvider non-publically to force caller
s to provider | 32 * 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 | 33 * make a flags (pendingIO) decision and not use the GrTP methods that don't tak
e flags. This |
| 34 * can be relaxed once http://skbug.com/4156 is fixed. | 34 * can be relaxed once https://bug.skia.org/4156 is fixed. |
| 35 */ | 35 */ |
| 36 class GrResourceProvider : protected GrTextureProvider { | 36 class GrResourceProvider : protected GrTextureProvider { |
| 37 public: | 37 public: |
| 38 GrResourceProvider(GrGpu* gpu, GrResourceCache* cache); | 38 GrResourceProvider(GrGpu* gpu, GrResourceCache* cache); |
| 39 | 39 |
| 40 template <typename T> T* findAndRefTByUniqueKey(const GrUniqueKey& key) { | 40 template <typename T> T* findAndRefTByUniqueKey(const GrUniqueKey& key) { |
| 41 return static_cast<T*>(this->findAndRefResourceByUniqueKey(key)); | 41 return static_cast<T*>(this->findAndRefResourceByUniqueKey(key)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 /** | 44 /** |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 using GrTextureProvider::assignUniqueKeyToResource; | 91 using GrTextureProvider::assignUniqueKeyToResource; |
| 92 using GrTextureProvider::findAndRefResourceByUniqueKey; | 92 using GrTextureProvider::findAndRefResourceByUniqueKey; |
| 93 using GrTextureProvider::findAndRefTextureByUniqueKey; | 93 using GrTextureProvider::findAndRefTextureByUniqueKey; |
| 94 using GrTextureProvider::abandon; | 94 using GrTextureProvider::abandon; |
| 95 | 95 |
| 96 enum Flags { | 96 enum Flags { |
| 97 /** If the caller intends to do direct reads/writes to/from the CPU then
this flag must be | 97 /** If the caller intends to do direct reads/writes to/from the CPU then
this flag must be |
| 98 * set when accessing resources during a GrDrawTarget flush. This inclu
des the execution of | 98 * set when accessing resources during a GrDrawTarget flush. This inclu
des the execution of |
| 99 * GrBatch objects. The reason is that these memory operations are done
immediately and | 99 * GrBatch objects. The reason is that these memory operations are done
immediately and |
| 100 * will occur out of order WRT the operations being flushed. | 100 * will occur out of order WRT the operations being flushed. |
| 101 * Make this automatic: http://skbug.com/4156 | 101 * Make this automatic: https://bug.skia.org/4156 |
| 102 */ | 102 */ |
| 103 kNoPendingIO_Flag = kNoPendingIO_ScratchTextureFlag, | 103 kNoPendingIO_Flag = kNoPendingIO_ScratchTextureFlag, |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 enum BufferUsage { | 106 enum BufferUsage { |
| 107 /** Caller intends to specify the buffer data rarely with respect to the
number of draws | 107 /** Caller intends to specify the buffer data rarely with respect to the
number of draws |
| 108 that read the data. */ | 108 that read the data. */ |
| 109 kStatic_BufferUsage, | 109 kStatic_BufferUsage, |
| 110 /** Caller intends to respecify the buffer data frequently between draws
. */ | 110 /** Caller intends to respecify the buffer data frequently between draws
. */ |
| 111 kDynamic_BufferUsage, | 111 kDynamic_BufferUsage, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 const GrUniqueKey& key); | 153 const GrUniqueKey& key); |
| 154 | 154 |
| 155 const GrIndexBuffer* createQuadIndexBuffer(); | 155 const GrIndexBuffer* createQuadIndexBuffer(); |
| 156 | 156 |
| 157 GrUniqueKey fQuadIndexBufferKey; | 157 GrUniqueKey fQuadIndexBufferKey; |
| 158 | 158 |
| 159 typedef GrTextureProvider INHERITED; | 159 typedef GrTextureProvider INHERITED; |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 #endif | 162 #endif |
| OLD | NEW |