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 "SkImageFilter.h" | 13 #include "SkImageFilter.h" |
13 | 14 |
14 class GrSingleOwner; | 15 class GrSingleOwner; |
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 * |
25 * @param desc Description of the texture properties. | 26 * @param desc Description of the texture properties. |
26 * @param budgeted Does the texture count against the resource cache budget
? | 27 * @param budgeted Does the texture count against the resource cache bu
dget? |
| 28 * @param texels A contiguous array of mipmap levels |
| 29 * @param mipLevelCount The amount of elements in the texels array |
| 30 */ |
| 31 GrTexture* createMipMappedTexture(const GrSurfaceDesc& desc, SkBudgeted budg
eted, |
| 32 const GrMipLevel* texels, int mipLevelCoun
t); |
| 33 |
| 34 /** |
| 35 * This function is a shim which creates a SkTArray<GrMipLevel> of size 1. |
| 36 * It then calls createTexture with that SkTArray. |
| 37 * |
27 * @param srcData Pointer to the pixel values (optional). | 38 * @param srcData Pointer to the pixel values (optional). |
28 * @param rowBytes The number of bytes between rows of the texture. Zero | 39 * @param rowBytes The number of bytes between rows of the texture. Zero |
29 * implies tightly packed rows. For compressed pixel config
s, this | 40 * implies tightly packed rows. For compressed pixel config
s, this |
30 * field is ignored. | 41 * field is ignored. |
31 */ | 42 */ |
32 GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, con
st void* srcData, | 43 GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted, con
st void* srcData, |
33 size_t rowBytes); | 44 size_t rowBytes); |
34 | 45 |
35 /** Shortcut for creating a texture with no initial data to upload. */ | 46 /** Shortcut for creating a texture with no initial data to upload. */ |
36 GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted) { | 47 GrTexture* createTexture(const GrSurfaceDesc& desc, SkBudgeted budgeted) { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 | 165 |
155 private: | 166 private: |
156 GrResourceCache* fCache; | 167 GrResourceCache* fCache; |
157 GrGpu* fGpu; | 168 GrGpu* fGpu; |
158 | 169 |
159 // In debug builds we guard against improper thread handling | 170 // In debug builds we guard against improper thread handling |
160 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) | 171 SkDEBUGCODE(mutable GrSingleOwner* fSingleOwner;) |
161 }; | 172 }; |
162 | 173 |
163 #endif | 174 #endif |
OLD | NEW |