| OLD | NEW |
| 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 * texture support). NULL implies clamp wrap modes. | 201 * texture support). NULL implies clamp wrap modes. |
| 202 * @param desc Description of the texture properties. | 202 * @param desc Description of the texture properties. |
| 203 * @param cacheID Cache-specific properties (e.g., texture gen ID) | 203 * @param cacheID Cache-specific properties (e.g., texture gen ID) |
| 204 * @param srcData Pointer to the pixel values. | 204 * @param srcData Pointer to the pixel values. |
| 205 * @param rowBytes The number of bytes between rows of the texture. Zero | 205 * @param rowBytes The number of bytes between rows of the texture. Zero |
| 206 * implies tightly packed rows. For compressed pixel config
s, this | 206 * implies tightly packed rows. For compressed pixel config
s, this |
| 207 * field is ignored. | 207 * field is ignored. |
| 208 * @param cacheKey (optional) If non-NULL, we'll write the cache key we use
d to cacheKey. | 208 * @param cacheKey (optional) If non-NULL, we'll write the cache key we use
d to cacheKey. |
| 209 */ | 209 */ |
| 210 GrTexture* createTexture(const GrTextureParams* params, | 210 GrTexture* createTexture(const GrTextureParams* params, |
| 211 const GrTextureDesc& desc, | 211 const GrSurfaceDesc& desc, |
| 212 const GrCacheID& cacheID, | 212 const GrCacheID& cacheID, |
| 213 const void* srcData, | 213 const void* srcData, |
| 214 size_t rowBytes, | 214 size_t rowBytes, |
| 215 GrResourceKey* cacheKey = NULL); | 215 GrResourceKey* cacheKey = NULL); |
| 216 /** | 216 /** |
| 217 * Search for an entry based on key and dimensions. If found, ref it and ret
urn it. The return | 217 * Search for an entry based on key and dimensions. If found, ref it and ret
urn it. The return |
| 218 * value will be NULL if not found. The caller must balance with a call to u
nref. | 218 * value will be NULL if not found. The caller must balance with a call to u
nref. |
| 219 * | 219 * |
| 220 * @param desc Description of the texture properties. | 220 * @param desc Description of the texture properties. |
| 221 * @param cacheID Cache-specific properties (e.g., texture gen ID) | 221 * @param cacheID Cache-specific properties (e.g., texture gen ID) |
| 222 * @param params The texture params used to draw a texture may help deter
mine | 222 * @param params The texture params used to draw a texture may help deter
mine |
| 223 * the cache entry used. (e.g. different versions may exist | 223 * the cache entry used. (e.g. different versions may exist |
| 224 * for different wrap modes on GPUs with limited NPOT | 224 * for different wrap modes on GPUs with limited NPOT |
| 225 * texture support). NULL implies clamp wrap modes. | 225 * texture support). NULL implies clamp wrap modes. |
| 226 */ | 226 */ |
| 227 GrTexture* findAndRefTexture(const GrTextureDesc& desc, | 227 GrTexture* findAndRefTexture(const GrSurfaceDesc& desc, |
| 228 const GrCacheID& cacheID, | 228 const GrCacheID& cacheID, |
| 229 const GrTextureParams* params); | 229 const GrTextureParams* params); |
| 230 /** | 230 /** |
| 231 * Determines whether a texture is in the cache. If the texture is found it | 231 * Determines whether a texture is in the cache. If the texture is found it |
| 232 * will not be locked or returned. This call does not affect the priority of | 232 * will not be locked or returned. This call does not affect the priority of |
| 233 * the texture for deletion. | 233 * the texture for deletion. |
| 234 */ | 234 */ |
| 235 bool isTextureInCache(const GrTextureDesc& desc, | 235 bool isTextureInCache(const GrSurfaceDesc& desc, |
| 236 const GrCacheID& cacheID, | 236 const GrCacheID& cacheID, |
| 237 const GrTextureParams* params) const; | 237 const GrTextureParams* params) const; |
| 238 | 238 |
| 239 /** | 239 /** |
| 240 * Enum that determines how closely a returned scratch texture must match | 240 * Enum that determines how closely a returned scratch texture must match |
| 241 * a provided GrTextureDesc. | 241 * a provided GrSurfaceDesc. |
| 242 */ | 242 */ |
| 243 enum ScratchTexMatch { | 243 enum ScratchTexMatch { |
| 244 /** | 244 /** |
| 245 * Finds a texture that exactly matches the descriptor. | 245 * Finds a texture that exactly matches the descriptor. |
| 246 */ | 246 */ |
| 247 kExact_ScratchTexMatch, | 247 kExact_ScratchTexMatch, |
| 248 /** | 248 /** |
| 249 * Finds a texture that approximately matches the descriptor. Will be | 249 * Finds a texture that approximately matches the descriptor. Will be |
| 250 * at least as large in width and height as desc specifies. If desc | 250 * at least as large in width and height as desc specifies. If desc |
| 251 * specifies that texture is a render target then result will be a | 251 * specifies that texture is a render target then result will be a |
| (...skipping 10 matching lines...) Expand all Loading... |
| 262 * It is guaranteed that the same texture will not be returned in subsequent | 262 * It is guaranteed that the same texture will not be returned in subsequent |
| 263 * calls until all refs to the texture are dropped. | 263 * calls until all refs to the texture are dropped. |
| 264 * | 264 * |
| 265 * Textures created by createTexture() hide the complications of | 265 * Textures created by createTexture() hide the complications of |
| 266 * tiling non-power-of-two textures on APIs that don't support this (e.g. | 266 * tiling non-power-of-two textures on APIs that don't support this (e.g. |
| 267 * unextended GLES2). NPOT scratch textures are not tilable on such APIs. | 267 * unextended GLES2). NPOT scratch textures are not tilable on such APIs. |
| 268 * | 268 * |
| 269 * internalFlag is a temporary workaround until changes in the internal | 269 * internalFlag is a temporary workaround until changes in the internal |
| 270 * architecture are complete. Use the default value. | 270 * architecture are complete. Use the default value. |
| 271 */ | 271 */ |
| 272 GrTexture* refScratchTexture(const GrTextureDesc&, ScratchTexMatch match, | 272 GrTexture* refScratchTexture(const GrSurfaceDesc&, ScratchTexMatch match, |
| 273 bool internalFlag = false); | 273 bool internalFlag = false); |
| 274 | 274 |
| 275 /** | 275 /** |
| 276 * Creates a texture that is outside the cache. Does not count against | 276 * Creates a texture that is outside the cache. Does not count against |
| 277 * cache's budget. | 277 * cache's budget. |
| 278 * | 278 * |
| 279 * Textures created by createTexture() hide the complications of | 279 * Textures created by createTexture() hide the complications of |
| 280 * tiling non-power-of-two textures on APIs that don't support this (e.g. | 280 * tiling non-power-of-two textures on APIs that don't support this (e.g. |
| 281 * unextended GLES2). NPOT uncached textures are not tilable on such APIs. | 281 * unextended GLES2). NPOT uncached textures are not tilable on such APIs. |
| 282 */ | 282 */ |
| 283 GrTexture* createUncachedTexture(const GrTextureDesc& desc, | 283 GrTexture* createUncachedTexture(const GrSurfaceDesc& desc, |
| 284 void* srcData, | 284 void* srcData, |
| 285 size_t rowBytes); | 285 size_t rowBytes); |
| 286 | 286 |
| 287 /** | 287 /** |
| 288 * Returns true if the specified use of an indexed texture is supported. | 288 * Returns true if the specified use of an indexed texture is supported. |
| 289 * Support may depend upon whether the texture params indicate that the | 289 * Support may depend upon whether the texture params indicate that the |
| 290 * texture will be tiled. Passing NULL for the texture params indicates | 290 * texture will be tiled. Passing NULL for the texture params indicates |
| 291 * clamp mode. | 291 * clamp mode. |
| 292 */ | 292 */ |
| 293 bool supportsIndex8PixelConfig(const GrTextureParams*, | 293 bool supportsIndex8PixelConfig(const GrTextureParams*, |
| (...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 | 994 |
| 995 class AutoRestoreEffects; | 995 class AutoRestoreEffects; |
| 996 class AutoCheckFlush; | 996 class AutoCheckFlush; |
| 997 /// Sets the paint and returns the target to draw into. The paint can be NUL
L in which case the | 997 /// Sets the paint and returns the target to draw into. The paint can be NUL
L in which case the |
| 998 /// draw state is left unmodified. | 998 /// draw state is left unmodified. |
| 999 GrDrawTarget* prepareToDraw(const GrPaint*, BufferedDraw, AutoRestoreEffects
*, AutoCheckFlush*); | 999 GrDrawTarget* prepareToDraw(const GrPaint*, BufferedDraw, AutoRestoreEffects
*, AutoCheckFlush*); |
| 1000 | 1000 |
| 1001 void internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath& path, | 1001 void internalDrawPath(GrDrawTarget* target, bool useAA, const SkPath& path, |
| 1002 const GrStrokeInfo& stroke); | 1002 const GrStrokeInfo& stroke); |
| 1003 | 1003 |
| 1004 GrTexture* createResizedTexture(const GrTextureDesc& desc, | 1004 GrTexture* createResizedTexture(const GrSurfaceDesc& desc, |
| 1005 const GrCacheID& cacheID, | 1005 const GrCacheID& cacheID, |
| 1006 const void* srcData, | 1006 const void* srcData, |
| 1007 size_t rowBytes, | 1007 size_t rowBytes, |
| 1008 bool filter); | 1008 bool filter); |
| 1009 | 1009 |
| 1010 GrTexture* createNewScratchTexture(const GrTextureDesc& desc); | 1010 GrTexture* createNewScratchTexture(const GrSurfaceDesc& desc); |
| 1011 | 1011 |
| 1012 /** | 1012 /** |
| 1013 * These functions create premul <-> unpremul effects if it is possible to g
enerate a pair | 1013 * These functions create premul <-> unpremul effects if it is possible to g
enerate a pair |
| 1014 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O
therwise, they | 1014 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O
therwise, they |
| 1015 * return NULL. | 1015 * return NULL. |
| 1016 */ | 1016 */ |
| 1017 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); | 1017 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); |
| 1018 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); | 1018 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c
onst SkMatrix&); |
| 1019 | 1019 |
| 1020 /** | 1020 /** |
| 1021 * This callback allows the resource cache to callback into the GrContext | 1021 * This callback allows the resource cache to callback into the GrContext |
| 1022 * when the cache is still overbudget after a purge. | 1022 * when the cache is still overbudget after a purge. |
| 1023 */ | 1023 */ |
| 1024 static bool OverbudgetCB(void* data); | 1024 static bool OverbudgetCB(void* data); |
| 1025 | 1025 |
| 1026 typedef SkRefCnt INHERITED; | 1026 typedef SkRefCnt INHERITED; |
| 1027 }; | 1027 }; |
| 1028 | 1028 |
| 1029 #endif | 1029 #endif |
| OLD | NEW |