Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: include/gpu/GrTextureProvider.h

Issue 1249543003: Creating functions for uploading a mipmapped texture. (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: No longer exposing SkMipMap and SkCachedData. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 ?
24 * @param srcData Pointer to the pixel values (optional). 26 * @param srcData Pointer to the pixel values (optional).
25 * @param rowBytes The number of bytes between rows of the texture. Zero 27 * @param rowBytes The number of bytes between rows of the texture. Zero
26 * implies tightly packed rows. For compressed pixel config s, this 28 * implies tightly packed rows. For compressed pixel config s, this
27 * field is ignored. 29 * field is ignored.
28 */ 30 */
29 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, const voi d* srcData, 31 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, const voi d* srcData,
30 size_t rowBytes); 32 size_t rowBytes);
31 33
32 /** Shortcut for creating a texture with no initial data to upload. */ 34 /** Shortcut for creating a texture with no initial data to upload. */
33 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted) { 35 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted) {
34 return this->createTexture(desc, budgeted, NULL, 0); 36 return this->createTexture(desc, budgeted, NULL, 0);
35 } 37 }
36 38
39 /**
40 * Creates a new texture in the resource cache and returns it. The caller ow ns a
41 * ref on the returned texture which must be balanced by a call to unref.
42 *
43 * @param desc Description of the texture properties.
44 * @param budgeted Does the texture count against the resource cache budget?
45 * @param texels An array of mipmap levels
46 */
47 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted,
48 SkTArray<SkMipMapLevel>& texels);
49
37 /** Assigns a unique key to the texture. The texture will be findable via th is key using 50 /** 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. */ 51 findTextureByUniqueKey(). If an existing texture has this key, it's key will be removed. */
39 void assignUniqueKeyToTexture(const GrUniqueKey& key, GrTexture* texture) { 52 void assignUniqueKeyToTexture(const GrUniqueKey& key, GrTexture* texture) {
40 this->assignUniqueKeyToResource(key, texture); 53 this->assignUniqueKeyToResource(key, texture);
41 } 54 }
42 55
43 /** Finds a texture by unique key. If the texture is found it is ref'ed and returned. */ 56 /** Finds a texture by unique key. If the texture is found it is ref'ed and returned. */
44 GrTexture* findAndRefTextureByUniqueKey(const GrUniqueKey& key) { 57 GrTexture* findAndRefTextureByUniqueKey(const GrUniqueKey& key) {
45 GrGpuResource* resource = this->findAndRefResourceByUniqueKey(key); 58 GrGpuResource* resource = this->findAndRefResourceByUniqueKey(key);
46 if (resource) { 59 if (resource) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 SkASSERT(SkToBool(fGpu) == SkToBool(fCache)); 175 SkASSERT(SkToBool(fGpu) == SkToBool(fCache));
163 return !SkToBool(fCache); 176 return !SkToBool(fCache);
164 } 177 }
165 178
166 private: 179 private:
167 GrResourceCache* fCache; 180 GrResourceCache* fCache;
168 GrGpu* fGpu; 181 GrGpu* fGpu;
169 }; 182 };
170 183
171 #endif 184 #endif
OLDNEW
« no previous file with comments | « include/core/SkMipMapLevel.h ('k') | include/gpu/SkGr.h » ('j') | src/gpu/GrGpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698