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 GrTextureProvider_DEFINED | 8 #ifndef GrTextureProvider_DEFINED |
9 #define GrTextureProvider_DEFINED | 9 #define GrTextureProvider_DEFINED |
10 | 10 |
11 #include "GrTexture.h" | 11 #include "GrTexture.h" |
12 #include "GrTypes.h" | 12 #include "GrTypes.h" |
13 | 13 |
14 class GrSingleOwner; | 14 class GrSingleOwner; |
| 15 class GrTextureProxy; |
15 | 16 |
16 class SK_API GrTextureProvider { | 17 class SK_API GrTextureProvider { |
17 public: | 18 public: |
18 /////////////////////////////////////////////////////////////////////////// | 19 /////////////////////////////////////////////////////////////////////////// |
19 // Textures | 20 // Textures |
20 | 21 |
21 /** | 22 /** |
22 * Creates a new texture in the resource cache and returns it. The caller ow
ns a | 23 * Creates a new texture in the resource cache and returns it. The caller ow
ns a |
23 * ref on the returned texture which must be balanced by a call to unref. | 24 * ref on the returned texture which must be balanced by a call to unref. |
24 * | 25 * |
(...skipping 21 matching lines...) Expand all Loading... |
46 GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted) { | 47 GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted) { |
47 return this->createTexture(desc, budgeted, nullptr, 0); | 48 return this->createTexture(desc, budgeted, nullptr, 0); |
48 } | 49 } |
49 | 50 |
50 /** Assigns a unique key to the texture. The texture will be findable via th
is key using | 51 /** Assigns a unique key to the texture. The texture will be findable via th
is key using |
51 findTextureByUniqueKey(). If an existing texture has this key, it's key
will be removed. */ | 52 findTextureByUniqueKey(). If an existing texture has this key, it's key
will be removed. */ |
52 void assignUniqueKeyToTexture(const GrUniqueKey& key, GrTexture* texture) { | 53 void assignUniqueKeyToTexture(const GrUniqueKey& key, GrTexture* texture) { |
53 this->assignUniqueKeyToResource(key, texture); | 54 this->assignUniqueKeyToResource(key, texture); |
54 } | 55 } |
55 | 56 |
| 57 void assignUniqueKeyToDeferredTexture(const GrUniqueKey& key, GrTextureProxy
* texture); |
| 58 |
56 /** Finds a texture by unique key. If the texture is found it is ref'ed and
returned. */ | 59 /** Finds a texture by unique key. If the texture is found it is ref'ed and
returned. */ |
57 GrTexture* findAndRefTextureByUniqueKey(const GrUniqueKey& key); | 60 GrTexture* findAndRefTextureByUniqueKey(const GrUniqueKey& key); |
58 | 61 |
| 62 GrTextureProxy* findAndRefTextureProxyByUniqueKey(const GrUniqueKey& key); |
| 63 |
59 /** | 64 /** |
60 * Determines whether a texture is associated with the unique key. If the te
xture is found it | 65 * Determines whether a texture is associated with the unique key. If the te
xture is found it |
61 * will not be locked or returned. This call does not affect the priority of
the resource for | 66 * will not be locked or returned. This call does not affect the priority of
the resource for |
62 * deletion. | 67 * deletion. |
63 */ | 68 */ |
64 bool existsTextureWithUniqueKey(const GrUniqueKey& key) const { | 69 bool existsTextureWithUniqueKey(const GrUniqueKey& key) const { |
65 return this->existsResourceWithUniqueKey(key); | 70 return this->existsResourceWithUniqueKey(key); |
66 } | 71 } |
67 | 72 |
68 /** | 73 /** |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 | 169 |
165 private: | 170 private: |
166 GrResourceCache* fCache; | 171 GrResourceCache* fCache; |
167 GrGpu* fGpu; | 172 GrGpu* fGpu; |
168 | 173 |
169 // In debug builds we guard against improper thread handling | 174 // In debug builds we guard against improper thread handling |
170 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) | 175 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) |
171 }; | 176 }; |
172 | 177 |
173 #endif | 178 #endif |
OLD | NEW |