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

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: Style changes based on CL feedback. Created 5 years, 5 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 "SkMipMap.h"
12 13
13 class SK_API GrTextureProvider { 14 class SK_API GrTextureProvider {
14 public: 15 public:
15 /////////////////////////////////////////////////////////////////////////// 16 ///////////////////////////////////////////////////////////////////////////
16 // Textures 17 // Textures
17 18
18 /** 19 /**
19 * Creates a new texture in the resource cache and returns it. The caller ow ns a 20 * 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. 21 * ref on the returned texture which must be balanced by a call to unref.
21 * 22 *
22 * @param desc Description of the texture properties. 23 * @param desc Description of the texture properties.
23 * @param budgeted Does the texture count against the resource cache budget ? 24 * @param budgeted Does the texture count against the resource cache budget ?
24 * @param srcData Pointer to the pixel values (optional). 25 * @param srcData Pointer to the pixel values (optional).
25 * @param rowBytes The number of bytes between rows of the texture. Zero 26 * @param rowBytes The number of bytes between rows of the texture. Zero
26 * implies tightly packed rows. For compressed pixel config s, this 27 * implies tightly packed rows. For compressed pixel config s, this
27 * field is ignored. 28 * field is ignored.
28 */ 29 */
29 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, const voi d* srcData, 30 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, const voi d* srcData,
30 size_t rowBytes); 31 size_t rowBytes);
31 32
33 /**
bsalomon 2015/07/22 17:21:10 What do you think about combining createTexture an
cblume 2015/07/22 18:32:40 I like that idea. In general, I am in favor of ha
cblume 2015/07/24 23:49:03 Thinking a bit more about this...ideally mipmapped
34 * Creates a new mipmapped texture in the resource cache and returns it. The
35 * caller owns a ref on the returned texture which must be balanced by a
36 * call to unref.
37 *
38 * @param desc Description of the texture properties.
39 * @param budgeted Does the texture count against the resource cache budget?
40 * @param srcData The mipmap data used to populate the texture.
41 */
42 GrTexture* createMipmappedTexture(const GrSurfaceDesc& desc, bool budgeted,
43 const SkMipMap& srcData);
44
32 /** Shortcut for creating a texture with no initial data to upload. */ 45 /** Shortcut for creating a texture with no initial data to upload. */
33 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted) { 46 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted) {
34 return this->createTexture(desc, budgeted, NULL, 0); 47 return this->createTexture(desc, budgeted, NULL, 0);
35 } 48 }
36 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 }
(...skipping 120 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/SkMipMap.h ('k') | include/gpu/SkGr.h » ('j') | src/gpu/gl/GrGLGpu.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698