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

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

Issue 864383003: Remove createUncachedTexture function, attempt to recycle scratch in createTexture. (Closed) Base URL: https://skia.googlesource.com/skia.git@continue
Patch Set: more Created 5 years, 10 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 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 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 bool enableDistanceFieldFonts); 211 bool enableDistanceFieldFonts);
212 212
213 /////////////////////////////////////////////////////////////////////////// 213 ///////////////////////////////////////////////////////////////////////////
214 // Textures 214 // Textures
215 215
216 /** 216 /**
217 * Creates a new texture in the resource cache and returns it. The caller ow ns a 217 * Creates a new texture in the resource cache and returns it. The caller ow ns a
218 * ref on the returned texture which must be balanced by a call to unref. 218 * ref on the returned texture which must be balanced by a call to unref.
219 * 219 *
220 * @param desc Description of the texture properties. 220 * @param desc Description of the texture properties.
221 * @param srcData Pointer to the pixel values. 221 * @param budgeted Does the texture count against the resource cache budget ?
222 * @param srcData Pointer to the pixel values (optional).
222 * @param rowBytes The number of bytes between rows of the texture. Zero 223 * @param rowBytes The number of bytes between rows of the texture. Zero
223 * implies tightly packed rows. For compressed pixel config s, this 224 * implies tightly packed rows. For compressed pixel config s, this
224 * field is ignored. 225 * field is ignored.
225 */ 226 */
226 GrTexture* createTexture(const GrSurfaceDesc& desc, const void* srcData, siz e_t rowBytes); 227 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted, const voi d* srcData,
228 size_t rowBytes);
227 229
228 GrTexture* createTexture(const GrSurfaceDesc& desc) { 230 GrTexture* createTexture(const GrSurfaceDesc& desc, bool budgeted) {
229 return this->createTexture(desc, NULL, 0); 231 return this->createTexture(desc, budgeted, NULL, 0);
230 } 232 }
231 233
232 /** 234 /**
233 * Creates a texture that is outside the cache. Does not count against 235 * DEPRECATED: use createTexture().
234 * cache's budget.
235 *
236 * TODO: Add a budgeted param to createTexture and remove this function.
237 */ 236 */
238 GrTexture* createUncachedTexture(const GrSurfaceDesc& desc, void* srcData, s ize_t rowBytes); 237 GrTexture* createUncachedTexture(const GrSurfaceDesc& desc, void* srcData, s ize_t rowBytes) {
238 return this->createTexture(desc, false, srcData, rowBytes);
239 }
239 240
240 /** 241 /**
241 * Enum that determines how closely a returned scratch texture must match 242 * Enum that determines how closely a returned scratch texture must match
242 * a provided GrSurfaceDesc. 243 * a provided GrSurfaceDesc.
243 */ 244 */
244 enum ScratchTexMatch { 245 enum ScratchTexMatch {
245 /** 246 /**
246 * Finds a texture that exactly matches the descriptor. 247 * Finds a texture that exactly matches the descriptor.
247 */ 248 */
248 kExact_ScratchTexMatch, 249 kExact_ScratchTexMatch,
(...skipping 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 GrDrawTarget* prepareToDraw(GrPipelineBuilder*, const GrPaint* paint, const AutoCheckFlush*); 831 GrDrawTarget* prepareToDraw(GrPipelineBuilder*, const GrPaint* paint, const AutoCheckFlush*);
831 832
832 void internalDrawPath(GrDrawTarget*, 833 void internalDrawPath(GrDrawTarget*,
833 GrPipelineBuilder*, 834 GrPipelineBuilder*,
834 const SkMatrix& viewMatrix, 835 const SkMatrix& viewMatrix,
835 GrColor, 836 GrColor,
836 bool useAA, 837 bool useAA,
837 const SkPath&, 838 const SkPath&,
838 const GrStrokeInfo&); 839 const GrStrokeInfo&);
839 840
840 // TODO: Move this out of GrContext. 841 GrTexture* internalRefScratchTexture(const GrSurfaceDesc&, uint32_t flags);
841 GrTexture* createResizedTexture(const GrSurfaceDesc&,
842 const GrContentKey& origKey,
843 const void* srcData,
844 size_t rowBytes,
845 bool filter);
846 842
847 /** 843 /**
848 * These functions create premul <-> unpremul effects if it is possible to g enerate a pair 844 * These functions create premul <-> unpremul effects if it is possible to g enerate a pair
849 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O therwise, they 845 * of effects that make a readToUPM->writeToPM->readToUPM cycle invariant. O therwise, they
850 * return NULL. 846 * return NULL.
851 */ 847 */
852 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c onst SkMatrix&); 848 const GrFragmentProcessor* createPMToUPMEffect(GrTexture*, bool swapRAndB, c onst SkMatrix&);
853 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c onst SkMatrix&); 849 const GrFragmentProcessor* createUPMToPMEffect(GrTexture*, bool swapRAndB, c onst SkMatrix&);
854 850
855 /** 851 /**
856 * This callback allows the resource cache to callback into the GrContext 852 * This callback allows the resource cache to callback into the GrContext
857 * when the cache is still over budget after a purge. 853 * when the cache is still over budget after a purge.
858 */ 854 */
859 static void OverBudgetCB(void* data); 855 static void OverBudgetCB(void* data);
860 856
861 typedef SkRefCnt INHERITED; 857 typedef SkRefCnt INHERITED;
862 }; 858 };
863 859
864 #endif 860 #endif
OLDNEW
« no previous file with comments | « gm/texdata.cpp ('k') | src/effects/SkBlurMaskFilter.cpp » ('j') | src/gpu/SkGpuDevice.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698