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 "../core/SkMipMap.h" | |
scroggo
2015/07/21 14:44:23
Within Skia, we do not fully qualify our includes.
| |
12 | 13 |
13 class SK_API GrTextureProvider { | 14 class SK_API GrTextureProvider { |
14 public: | 15 public: |
15 /////////////////////////////////////////////////////////////////////////// | 16 /////////////////////////////////////////////////////////////////////////// |
16 // Textures | 17 // Textures |
17 | 18 |
18 /** | 19 /** |
19 * Creates a new texture in the resource cache and returns it. The caller ow ns a | 20 * Creates a new texture in the resource cache and returns it. The caller ow ns a |
20 * ref on the returned texture which must be balanced by a call to unref. | 21 * ref on the returned texture which must be balanced by a call to unref. |
21 * | 22 * |
22 * @param desc Description of the texture properties. | 23 * @param desc Description of the texture properties. |
23 * @param budgeted Does the texture count against the resource cache budget ? | 24 * @param budgeted Does the texture count against the resource cache budget ? |
24 * @param srcData Pointer to the pixel values (optional). | 25 * @param srcData Pointer to the pixel values (optional). |
25 * @param rowBytes The number of bytes between rows of the texture. Zero | 26 * @param rowBytes The number of bytes between rows of the texture. Zero |
26 * implies tightly packed rows. For compressed pixel config s, this | 27 * implies tightly packed rows. For compressed pixel config s, this |
27 * field is ignored. | 28 * field is ignored. |
28 */ | 29 */ |
29 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, const voi d* srcData, | 30 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, const voi d* srcData, |
30 size_t rowBytes); | 31 size_t rowBytes); |
31 | 32 |
33 | |
34 /** | |
35 * Creates a new mipmapped texture in the resource cache and returns it. The | |
36 * caller owns a ref on the returned texture which must be balanced by a | |
37 * call to unref. | |
38 * | |
39 * @param desc Description of the texture properties. | |
40 * @param budgeted Does the texture count against the resource cache budget? | |
41 * @param srcData The mipmip data used to populate the texture. | |
42 */ | |
43 GrTexture* createMipmappedTexture(const GrSurfaceDesc& desc, bool budgeted, | |
44 const SkMipMap& srcData); | |
45 | |
32 /** Shortcut for creating a texture with no initial data to upload. */ | 46 /** Shortcut for creating a texture with no initial data to upload. */ |
33 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted) { | 47 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted) { |
34 return this->createTexture(desc, budgeted, NULL, 0); | 48 return this->createTexture(desc, budgeted, NULL, 0); |
35 } | 49 } |
36 | 50 |
37 /** 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 |
38 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. */ |
39 void assignUniqueKeyToTexture(const GrUniqueKey& key, GrTexture* texture) { | 53 void assignUniqueKeyToTexture(const GrUniqueKey& key, GrTexture* texture) { |
40 this->assignUniqueKeyToResource(key, texture); | 54 this->assignUniqueKeyToResource(key, texture); |
41 } | 55 } |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 SkASSERT(SkToBool(fGpu) == SkToBool(fCache)); | 176 SkASSERT(SkToBool(fGpu) == SkToBool(fCache)); |
163 return !SkToBool(fCache); | 177 return !SkToBool(fCache); |
164 } | 178 } |
165 | 179 |
166 private: | 180 private: |
167 GrResourceCache* fCache; | 181 GrResourceCache* fCache; |
168 GrGpu* fGpu; | 182 GrGpu* fGpu; |
169 }; | 183 }; |
170 | 184 |
171 #endif | 185 #endif |
OLD | NEW |