| 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 "SkImageFilter.h" | 12 #include "SkImageFilter.h" |
| 13 #include "SkMipMapLevel.h" |
| 14 #include "SkTArray.h" |
| 13 | 15 |
| 14 class SK_API GrTextureProvider { | 16 class SK_API GrTextureProvider { |
| 15 public: | 17 public: |
| 16 /////////////////////////////////////////////////////////////////////////// | 18 /////////////////////////////////////////////////////////////////////////// |
| 17 // Textures | 19 // Textures |
| 18 | 20 |
| 19 /** | 21 /** |
| 20 * 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 |
| 21 * 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. |
| 22 * | 24 * |
| 23 * @param desc Description of the texture properties. | 25 * @param desc Description of the texture properties. |
| 24 * @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 texels An array of mipmap levels |
| 28 */ |
| 29 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, |
| 30 const SkTArray<SkMipMapLevel>& texels); |
| 31 |
| 32 /** |
| 33 * This function is a shim which creates a SkTArray<SkMipMapLevel> of size 1
. |
| 34 * It then calls createTexture with that SkTArray. |
| 35 * |
| 25 * @param srcData Pointer to the pixel values (optional). | 36 * @param srcData Pointer to the pixel values (optional). |
| 26 * @param rowBytes The number of bytes between rows of the texture. Zero | 37 * @param rowBytes The number of bytes between rows of the texture. Zero |
| 27 * implies tightly packed rows. For compressed pixel config
s, this | 38 * implies tightly packed rows. For compressed pixel config
s, this |
| 28 * field is ignored. | 39 * field is ignored. |
| 29 */ | 40 */ |
| 30 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, const voi
d* srcData, | 41 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, const voi
d* srcData, |
| 31 size_t rowBytes); | 42 size_t rowBytes); |
| 32 | 43 |
| 33 /** Shortcut for creating a texture with no initial data to upload. */ | 44 /** Shortcut for creating a texture with no initial data to upload. */ |
| 34 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted) { | 45 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted) { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 SkASSERT(SkToBool(fGpu) == SkToBool(fCache)); | 193 SkASSERT(SkToBool(fGpu) == SkToBool(fCache)); |
| 183 return !SkToBool(fCache); | 194 return !SkToBool(fCache); |
| 184 } | 195 } |
| 185 | 196 |
| 186 private: | 197 private: |
| 187 GrResourceCache* fCache; | 198 GrResourceCache* fCache; |
| 188 GrGpu* fGpu; | 199 GrGpu* fGpu; |
| 189 }; | 200 }; |
| 190 | 201 |
| 191 #endif | 202 #endif |
| OLD | NEW |