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

Side by Side Diff: include/core/SkSurface.h

Issue 1709163003: Add wrapBackendTextureAsRenderTarget API (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: fix test Created 4 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
« no previous file with comments | « no previous file | include/gpu/GrTextureProvider.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 2012 Google Inc. 2 * Copyright 2012 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 SkSurface_DEFINED 8 #ifndef SkSurface_DEFINED
9 #define SkSurface_DEFINED 9 #define SkSurface_DEFINED
10 10
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 * SkSurface. 101 * SkSurface.
102 */ 102 */
103 static SkSurface* NewFromBackendTexture(GrContext*, const GrBackendTextureDe sc&, 103 static SkSurface* NewFromBackendTexture(GrContext*, const GrBackendTextureDe sc&,
104 const SkSurfaceProps*); 104 const SkSurfaceProps*);
105 // Legacy alias 105 // Legacy alias
106 static SkSurface* NewWrappedRenderTarget(GrContext* ctx, const GrBackendText ureDesc& desc, 106 static SkSurface* NewWrappedRenderTarget(GrContext* ctx, const GrBackendText ureDesc& desc,
107 const SkSurfaceProps* props) { 107 const SkSurfaceProps* props) {
108 return NewFromBackendTexture(ctx, desc, props); 108 return NewFromBackendTexture(ctx, desc, props);
109 } 109 }
110 110
111
112 /** 111 /**
113 * Used to wrap a pre-existing 3D API rendering target as a SkSurface. Skia will not assume 112 * Used to wrap a pre-existing 3D API rendering target as a SkSurface. Skia will not assume
114 * ownership of the render target and the client must ensure the render tar get is valid for the 113 * ownership of the render target and the client must ensure the render tar get is valid for the
115 * lifetime of the SkSurface. 114 * lifetime of the SkSurface.
116 */ 115 */
117 static SkSurface* NewFromBackendRenderTarget(GrContext*, const GrBackendRend erTargetDesc&, 116 static SkSurface* NewFromBackendRenderTarget(GrContext*, const GrBackendRend erTargetDesc&,
118 const SkSurfaceProps*); 117 const SkSurfaceProps*);
119 118
120 /** 119 /**
120 * Used to wrap a pre-existing 3D API texture as a SkSurface. Skia will tre at the texture as
121 * a rendering target only, but unlike NewFromBackendRenderTarget, Skia wil l manage and own
122 * the associated render target objects (but not the provided texture). The kRenderTarget flag
123 * must be set on GrBackendTextureDesc for this to succeed. Skia will not a ssume ownership
124 * of the texture and the client must ensure the texture is valid for the l ifetime of the
125 * SkSurface.
126 */
127 static SkSurface* NewFromBackendTextureAsRenderTarget(
128 GrContext*, const GrBackendTextureDesc&, const SkSurfaceProps*);
129
130 /**
121 * Return a new surface whose contents will be drawn to an offscreen 131 * Return a new surface whose contents will be drawn to an offscreen
122 * render target, allocated by the surface. 132 * render target, allocated by the surface.
123 * 133 *
124 * The GrTextureStorageAllocator will be reused if SkImage snapshots create 134 * The GrTextureStorageAllocator will be reused if SkImage snapshots create
125 * additional textures. 135 * additional textures.
126 */ 136 */
127 static SkSurface* NewRenderTarget( 137 static SkSurface* NewRenderTarget(
128 GrContext*, Budgeted, const SkImageInfo&, int sampleCount, const SkS urfaceProps* = NULL, 138 GrContext*, Budgeted, const SkImageInfo&, int sampleCount, const SkS urfaceProps* = NULL,
129 GrTextureStorageAllocator = GrTextureStorageAllocator()); 139 GrTextureStorageAllocator = GrTextureStorageAllocator());
130 140
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 * 283 *
274 * This call can fail, returning false, for several reasons: 284 * This call can fail, returning false, for several reasons:
275 * - If srcR does not intersect the surface bounds. 285 * - If srcR does not intersect the surface bounds.
276 * - If the requested colortype/alphatype cannot be converted from the surf ace's types. 286 * - If the requested colortype/alphatype cannot be converted from the surf ace's types.
277 */ 287 */
278 bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBy tes, 288 bool readPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBy tes,
279 int srcX, int srcY); 289 int srcX, int srcY);
280 290
281 const SkSurfaceProps& props() const { return fProps; } 291 const SkSurfaceProps& props() const { return fProps; }
282 292
293 /**
294 * Issue any pending surface IO to the current backend 3D API and resolve an y surface MSAA.
295 */
296 void prepareForExternalIO();
297
283 protected: 298 protected:
284 SkSurface(int width, int height, const SkSurfaceProps*); 299 SkSurface(int width, int height, const SkSurfaceProps*);
285 SkSurface(const SkImageInfo&, const SkSurfaceProps*); 300 SkSurface(const SkImageInfo&, const SkSurfaceProps*);
286 301
287 // called by subclass if their contents have changed 302 // called by subclass if their contents have changed
288 void dirtyGenerationID() { 303 void dirtyGenerationID() {
289 fGenerationID = 0; 304 fGenerationID = 0;
290 } 305 }
291 306
292 private: 307 private:
293 const SkSurfaceProps fProps; 308 const SkSurfaceProps fProps;
294 const int fWidth; 309 const int fWidth;
295 const int fHeight; 310 const int fHeight;
296 uint32_t fGenerationID; 311 uint32_t fGenerationID;
297 312
298 typedef SkRefCnt INHERITED; 313 typedef SkRefCnt INHERITED;
299 }; 314 };
300 315
301 #endif 316 #endif
OLDNEW
« no previous file with comments | « no previous file | include/gpu/GrTextureProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698