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 |
(...skipping 11 matching lines...) Expand all Loading... |
22 * Creates a new texture in the resource cache and returns it. The caller ow
ns a | 22 * 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. | 23 * ref on the returned texture which must be balanced by a call to unref. |
24 * | 24 * |
25 * @param desc Description of the texture properties. | 25 * @param desc Description of the texture properties. |
26 * @param budgeted Does the texture count against the resource cache budget
? | 26 * @param budgeted Does the texture count against the resource cache budget
? |
27 * @param srcData Pointer to the pixel values (optional). | 27 * @param srcData Pointer to the pixel values (optional). |
28 * @param rowBytes The number of bytes between rows of the texture. Zero | 28 * @param rowBytes The number of bytes between rows of the texture. Zero |
29 * implies tightly packed rows. For compressed pixel config
s, this | 29 * implies tightly packed rows. For compressed pixel config
s, this |
30 * field is ignored. | 30 * field is ignored. |
31 */ | 31 */ |
32 GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, con
st void* srcData, | 32 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, const voi
d* srcData, |
33 size_t rowBytes); | 33 size_t rowBytes); |
34 | 34 |
35 /** Shortcut for creating a texture with no initial data to upload. */ | 35 /** Shortcut for creating a texture with no initial data to upload. */ |
36 GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted) { | 36 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted) { |
37 return this->createTexture(desc, budgeted, NULL, 0); | 37 return this->createTexture(desc, budgeted, NULL, 0); |
38 } | 38 } |
39 | 39 |
40 /** Assigns a unique key to the texture. The texture will be findable via th
is key using | 40 /** Assigns a unique key to the texture. The texture will be findable via th
is key using |
41 findTextureByUniqueKey(). If an existing texture has this key, it's key
will be removed. */ | 41 findTextureByUniqueKey(). If an existing texture has this key, it's key
will be removed. */ |
42 void assignUniqueKeyToTexture(const GrUniqueKey& key, GrTexture* texture) { | 42 void assignUniqueKeyToTexture(const GrUniqueKey& key, GrTexture* texture) { |
43 this->assignUniqueKeyToResource(key, texture); | 43 this->assignUniqueKeyToResource(key, texture); |
44 } | 44 } |
45 | 45 |
46 /** Finds a texture by unique key. If the texture is found it is ref'ed and
returned. */ | 46 /** Finds a texture by unique key. If the texture is found it is ref'ed and
returned. */ |
(...skipping 19 matching lines...) Expand all Loading... |
66 | 66 |
67 /** Legacy function that no longer should be used. */ | 67 /** Legacy function that no longer should be used. */ |
68 enum ScratchTexMatch { | 68 enum ScratchTexMatch { |
69 kExact_ScratchTexMatch, | 69 kExact_ScratchTexMatch, |
70 kApprox_ScratchTexMatch | 70 kApprox_ScratchTexMatch |
71 }; | 71 }; |
72 GrTexture* refScratchTexture(const GrSurfaceDesc& desc, ScratchTexMatch matc
h) { | 72 GrTexture* refScratchTexture(const GrSurfaceDesc& desc, ScratchTexMatch matc
h) { |
73 if (kApprox_ScratchTexMatch == match) { | 73 if (kApprox_ScratchTexMatch == match) { |
74 return this->createApproxTexture(desc); | 74 return this->createApproxTexture(desc); |
75 } else { | 75 } else { |
76 return this->createTexture(desc, SkBudgeted::kYes); | 76 return this->createTexture(desc, true); |
77 } | 77 } |
78 } | 78 } |
79 | 79 |
80 /////////////////////////////////////////////////////////////////////////// | 80 /////////////////////////////////////////////////////////////////////////// |
81 // Wrapped Backend Surfaces | 81 // Wrapped Backend Surfaces |
82 | 82 |
83 /** | 83 /** |
84 * Wraps an existing texture with a GrTexture object. | 84 * Wraps an existing texture with a GrTexture object. |
85 * | 85 * |
86 * OpenGL: if the object is a texture Gr may change its GL texture params | 86 * OpenGL: if the object is a texture Gr may change its GL texture params |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 154 |
155 private: | 155 private: |
156 GrResourceCache* fCache; | 156 GrResourceCache* fCache; |
157 GrGpu* fGpu; | 157 GrGpu* fGpu; |
158 | 158 |
159 // In debug builds we guard against improper thread handling | 159 // In debug builds we guard against improper thread handling |
160 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) | 160 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) |
161 }; | 161 }; |
162 | 162 |
163 #endif | 163 #endif |
OLD | NEW |