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

Unified Diff: include/core/SkSurface.h

Issue 848903004: Require budget decision when creating a RenderTarget SkSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix warning Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/xfermodes3.cpp ('k') | include/gpu/GrGpuResource.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkSurface.h
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h
index aa1e2cc2bbc9c76337ec324cae6868c090985fc2..1fd345a2fa89f05faa19e722b375f5063c355306 100644
--- a/include/core/SkSurface.h
+++ b/include/core/SkSurface.h
@@ -33,6 +33,18 @@ public:
SK_DECLARE_INST_COUNT(SkSurface)
/**
+ * Indicates whether a new surface or image should count against a cache budget. Currently this
+ * is only used by the GPU backend (sw-raster surfaces and images are never counted against the
+ * resource cache budget.)
+ */
+ enum Budgeted {
+ /** The surface or image does not count against the cache budget. */
+ kNo_Budgeted,
+ /** The surface or image counts against the cache budget. */
+ kYes_Budgeted
+ };
+
+ /**
* Create a new surface, using the specified pixels/rowbytes as its
* backend.
*
@@ -86,30 +98,27 @@ public:
* Return a new surface whose contents will be drawn to an offscreen
* render target, allocated by the surface.
*/
- static SkSurface* NewRenderTarget(GrContext*, const SkImageInfo&, int sampleCount,
+ static SkSurface* NewRenderTarget(GrContext*, Budgeted, const SkImageInfo&, int sampleCount,
const SkSurfaceProps* = NULL);
- static SkSurface* NewRenderTarget(GrContext* gr, const SkImageInfo& info) {
- return NewRenderTarget(gr, info, 0, NULL);
+ static SkSurface* NewRenderTarget(GrContext* gr, Budgeted b, const SkImageInfo& info) {
+ return NewRenderTarget(gr, b, info, 0, NULL);
}
/**
- * Return a new surface whose contents will be drawn to an offscreen
- * render target, allocated by the surface from the scratch texture pool
- * managed by the GrContext. The scratch texture pool serves the purpose
- * of retaining textures after they are no longer in use in order to
- * re-use them later without having to re-allocate. Scratch textures
- * should be used in cases where high turnover is expected. This allows,
- * for example, the copy on write to recycle a texture from a recently
- * released SkImage snapshot of the surface.
- * Note: Scratch textures count against the GrContext's cached resource
- * budget.
- */
- static SkSurface* NewScratchRenderTarget(GrContext*, const SkImageInfo&, int sampleCount,
- const SkSurfaceProps* = NULL);
-
- static SkSurface* NewScratchRenderTarget(GrContext* gr, const SkImageInfo& info) {
- return NewScratchRenderTarget(gr, info, 0, NULL);
+ * Deprecated - use the Budgeted param on NewRenderTarget.
+ */
+ static SkSurface* NewScratchRenderTarget(GrContext* gr, const SkImageInfo& info,
+ int sampleCount, const SkSurfaceProps* props) {
+ return NewRenderTarget(gr, kYes_Budgeted, info, sampleCount, props);
+ }
+
+ /**
+ * Deprecated - use the version that takes a Budgeted param.
+ */
+ static SkSurface* NewRenderTarget(GrContext* gr, const SkImageInfo& info, int sampleCount,
+ const SkSurfaceProps* props) {
+ return NewRenderTarget(gr, kNo_Budgeted, info, sampleCount, props);
}
int width() const { return fWidth; }
« no previous file with comments | « gm/xfermodes3.cpp ('k') | include/gpu/GrGpuResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698