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 "SkMipMapLevel.h" |
| 13 #include "SkTArray.h" |
12 | 14 |
13 class SK_API GrTextureProvider { | 15 class SK_API GrTextureProvider { |
14 public: | 16 public: |
15 /////////////////////////////////////////////////////////////////////////// | 17 /////////////////////////////////////////////////////////////////////////// |
16 // Textures | 18 // Textures |
17 | 19 |
18 /** | 20 /** |
19 * Creates a new texture in the resource cache and returns it. The caller ow
ns a | 21 * 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. | 22 * ref on the returned texture which must be balanced by a call to unref. |
21 * | 23 * |
22 * @param desc Description of the texture properties. | 24 * @param desc Description of the texture properties. |
23 * @param budgeted Does the texture count against the resource cache budget
? | 25 * @param budgeted Does the texture count against the resource cache budget? |
| 26 * @param texels An array of mipmap levels |
| 27 */ |
| 28 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, |
| 29 const SkTArray<SkMipMapLevel>& texels); |
| 30 |
| 31 /** |
| 32 * This function is a shim which creates a SkTArray<SkMipMapLevel> of size 1
. |
| 33 * It then calls createTexture with that SkTArray. |
| 34 * |
24 * @param srcData Pointer to the pixel values (optional). | 35 * @param srcData Pointer to the pixel values (optional). |
25 * @param rowBytes The number of bytes between rows of the texture. Zero | 36 * @param rowBytes The number of bytes between rows of the texture. Zero |
26 * implies tightly packed rows. For compressed pixel config
s, this | 37 * implies tightly packed rows. For compressed pixel config
s, this |
27 * field is ignored. | 38 * field is ignored. |
28 */ | 39 */ |
29 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, const voi
d* srcData, | 40 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, const voi
d* srcData, |
30 size_t rowBytes); | 41 size_t rowBytes); |
31 | 42 |
32 /** Shortcut for creating a texture with no initial data to upload. */ | 43 /** Shortcut for creating a texture with no initial data to upload. */ |
33 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted) { | 44 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted) { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 SkASSERT(SkToBool(fGpu) == SkToBool(fCache)); | 167 SkASSERT(SkToBool(fGpu) == SkToBool(fCache)); |
157 return !SkToBool(fCache); | 168 return !SkToBool(fCache); |
158 } | 169 } |
159 | 170 |
160 private: | 171 private: |
161 GrResourceCache* fCache; | 172 GrResourceCache* fCache; |
162 GrGpu* fGpu; | 173 GrGpu* fGpu; |
163 }; | 174 }; |
164 | 175 |
165 #endif | 176 #endif |
OLD | NEW |