| 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 GrSingleOwner; | 16 class GrSingleOwner; |
| 15 | 17 |
| 16 class SK_API GrTextureProvider { | 18 class SK_API GrTextureProvider { |
| 17 public: | 19 public: |
| 18 /////////////////////////////////////////////////////////////////////////// | 20 /////////////////////////////////////////////////////////////////////////// |
| 19 // Textures | 21 // Textures |
| 20 | 22 |
| 21 /** | 23 /** |
| 22 * Creates a new texture in the resource cache and returns it. The caller ow
ns a | 24 * 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. | 25 * ref on the returned texture which must be balanced by a call to unref. |
| 24 * | 26 * |
| 25 * @param desc Description of the texture properties. | 27 * @param desc Description of the texture properties. |
| 26 * @param budgeted Does the texture count against the resource cache budget
? | 28 * @param budgeted Does the texture count against the resource cache budget? |
| 29 * @param texels An array of mipmap levels |
| 30 */ |
| 31 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, |
| 32 const SkTArray<SkMipMapLevel>& texels); |
| 33 |
| 34 /** |
| 35 * This function is a shim which creates a SkTArray<SkMipMapLevel> 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, bool budgeted, const voi
d* srcData, | 43 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, const voi
d* 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, bool budgeted) { | 47 GrTexture* createTexture(const GrSurfaceDesc& desc, bool 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 |