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

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

Issue 1187523005: Add support for creating texture backed images where Skia will delete the texture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add default param to support Chrome's current callers Created 5 years, 6 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 | « include/gpu/GrGpuResource.h ('k') | include/gpu/GrTypes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 /////////////////////////////////////////////////////////////////////////// 100 ///////////////////////////////////////////////////////////////////////////
101 // Wrapped Backend Surfaces 101 // Wrapped Backend Surfaces
102 102
103 /** 103 /**
104 * Wraps an existing texture with a GrTexture object. 104 * Wraps an existing texture with a GrTexture object.
105 * 105 *
106 * OpenGL: if the object is a texture Gr may change its GL texture params 106 * OpenGL: if the object is a texture Gr may change its GL texture params
107 * when it is drawn. 107 * when it is drawn.
108 * 108 *
109 * @param desc description of the object to create.
110 *
111 * @return GrTexture object or NULL on failure. 109 * @return GrTexture object or NULL on failure.
112 */ 110 */
113 GrTexture* wrapBackendTexture(const GrBackendTextureDesc& desc); 111 GrTexture* wrapBackendTexture(const GrBackendTextureDesc& desc,
112 GrWrapOwnership = kBorrow_GrWrapOwnership);
114 113
115 /** 114 /**
116 * Wraps an existing render target with a GrRenderTarget object. It is 115 * Wraps an existing render target with a GrRenderTarget object. It is
117 * similar to wrapBackendTexture but can be used to draw into surfaces 116 * similar to wrapBackendTexture but can be used to draw into surfaces
118 * that are not also textures (e.g. FBO 0 in OpenGL, or an MSAA buffer that 117 * that are not also textures (e.g. FBO 0 in OpenGL, or an MSAA buffer that
119 * the client will resolve to a texture). 118 * the client will resolve to a texture). Currently wrapped render targets
120 * 119 * always use the kBorrow_GrWrapOwnership semantics.
121 * @param desc description of the object to create.
122 * 120 *
123 * @return GrTexture object or NULL on failure. 121 * @return GrTexture object or NULL on failure.
124 */ 122 */
125 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc& de sc); 123 GrRenderTarget* wrapBackendRenderTarget(const GrBackendRenderTargetDesc& de sc);
126 124
127 protected: 125 protected:
128 GrTextureProvider(GrGpu* gpu, GrResourceCache* cache) : fCache(cache), fGpu( gpu) {} 126 GrTextureProvider(GrGpu* gpu, GrResourceCache* cache) : fCache(cache), fGpu( gpu) {}
129 127
130 /** 128 /**
131 * Assigns a unique key to a resource. If the key is associated with another resource that 129 * Assigns a unique key to a resource. If the key is associated with another resource that
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 bool isAbandoned() const { 162 bool isAbandoned() const {
165 SkASSERT(SkToBool(fGpu) == SkToBool(fCache)); 163 SkASSERT(SkToBool(fGpu) == SkToBool(fCache));
166 return !SkToBool(fCache); 164 return !SkToBool(fCache);
167 } 165 }
168 166
169 GrResourceCache* fCache; 167 GrResourceCache* fCache;
170 GrGpu* fGpu; 168 GrGpu* fGpu;
171 }; 169 };
172 170
173 #endif 171 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrGpuResource.h ('k') | include/gpu/GrTypes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698