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

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

Issue 638403003: Remove uses of GrAutoScratchTexture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comment change Created 6 years, 2 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
« no previous file with comments | « no previous file | include/gpu/GrRenderTarget.h » ('j') | src/effects/SkDisplacementMapEffect.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2010 Google Inc. 2 * Copyright 2010 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 GrContext_DEFINED 8 #ifndef GrContext_DEFINED
9 #define GrContext_DEFINED 9 #define GrContext_DEFINED
10 10
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 * at least as large in width and height as desc specifies. If desc 273 * at least as large in width and height as desc specifies. If desc
274 * specifies that texture is a render target then result will be a 274 * specifies that texture is a render target then result will be a
275 * render target. If desc specifies a render target and doesn't set the 275 * render target. If desc specifies a render target and doesn't set the
276 * no stencil flag then result will have a stencil. Format and aa level 276 * no stencil flag then result will have a stencil. Format and aa level
277 * will always match. 277 * will always match.
278 */ 278 */
279 kApprox_ScratchTexMatch 279 kApprox_ScratchTexMatch
280 }; 280 };
281 281
282 /** 282 /**
283 * Returns a texture matching the desc. It's contents are unknown. Subsequen t 283 * Returns a texture matching the desc. It's contents are unknown. The calle r
284 * requests with the same descriptor are not guaranteed to return the same
285 * texture. The same texture is guaranteed not be returned again until it is
286 * unlocked. Call must be balanced with an unlockTexture() call. The caller
287 * owns a ref on the returned texture and must balance with a call to unref. 284 * owns a ref on the returned texture and must balance with a call to unref.
285 * It is guaranteed that the same texture will not be returned in subsequent
286 * calls until all refs to the texture are dropped.
288 * 287 *
289 * Textures created by createAndLockTexture() hide the complications of 288 * Textures created by createTexture() hide the complications of
290 * tiling non-power-of-two textures on APIs that don't support this (e.g. 289 * tiling non-power-of-two textures on APIs that don't support this (e.g.
291 * unextended GLES2). Tiling a NPOT texture created by lockScratchTexture on 290 * unextended GLES2). NPOT scratch textures are not tilable on such APIs.
292 * such an API will create gaps in the tiling pattern. This includes clamp
293 * mode. (This may be addressed in a future update.)7
294 * 291 *
295 * internalFlag is a temporary workaround until changes in the internal 292 * internalFlag is a temporary workaround until changes in the internal
296 * architecture are complete. Use the default value. 293 * architecture are complete. Use the default value.
297 */ 294 */
298 GrTexture* lockAndRefScratchTexture(const GrTextureDesc&, ScratchTexMatch ma tch, 295 GrTexture* refScratchTexture(const GrTextureDesc&, ScratchTexMatch match,
299 bool internalFlag = false); 296 bool internalFlag = false);
300 297
301 /** 298 /**
302 * Creates a texture that is outside the cache. Does not count against 299 * Creates a texture that is outside the cache. Does not count against
303 * cache's budget. 300 * cache's budget.
301 *
302 * Textures created by createTexture() hide the complications of
303 * tiling non-power-of-two textures on APIs that don't support this (e.g.
304 * unextended GLES2). NPOT uncached textures are not tilable on such APIs.
304 */ 305 */
305 GrTexture* createUncachedTexture(const GrTextureDesc& desc, 306 GrTexture* createUncachedTexture(const GrTextureDesc& desc,
306 void* srcData, 307 void* srcData,
307 size_t rowBytes); 308 size_t rowBytes);
308 309
309 /** 310 /**
310 * Returns true if the specified use of an indexed texture is supported. 311 * Returns true if the specified use of an indexed texture is supported.
311 * Support may depend upon whether the texture params indicate that the 312 * Support may depend upon whether the texture params indicate that the
312 * texture will be tiled. Passing NULL for the texture params indicates 313 * texture will be tiled. Passing NULL for the texture params indicates
313 * clamp mode. 314 * clamp mode.
(...skipping 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 } 1131 }
1131 1132
1132 GrTexture* set(GrContext* context, 1133 GrTexture* set(GrContext* context,
1133 const GrTextureDesc& desc, 1134 const GrTextureDesc& desc,
1134 GrContext::ScratchTexMatch match = GrContext::kApprox_Scratch TexMatch, 1135 GrContext::ScratchTexMatch match = GrContext::kApprox_Scratch TexMatch,
1135 bool internalFlag = 0) { 1136 bool internalFlag = 0) {
1136 this->reset(); 1137 this->reset();
1137 1138
1138 fContext = context; 1139 fContext = context;
1139 if (fContext) { 1140 if (fContext) {
1140 fTexture = fContext->lockAndRefScratchTexture(desc, match, internalF lag); 1141 fTexture = fContext->refScratchTexture(desc, match, internalFlag);
1141 if (NULL == fTexture) { 1142 if (NULL == fTexture) {
1142 fContext = NULL; 1143 fContext = NULL;
1143 } 1144 }
1144 return fTexture; 1145 return fTexture;
1145 } else { 1146 } else {
1146 return NULL; 1147 return NULL;
1147 } 1148 }
1148 } 1149 }
1149 1150
1150 GrTexture* texture() { return fTexture; } 1151 GrTexture* texture() { return fTexture; }
1151 1152
1152 private: 1153 private:
1153 GrContext* fContext; 1154 GrContext* fContext;
1154 GrTexture* fTexture; 1155 GrTexture* fTexture;
1155 }; 1156 };
1156 1157
1157 #endif 1158 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrRenderTarget.h » ('j') | src/effects/SkDisplacementMapEffect.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698