diff options
author | 2015-07-08 12:54:04 -0700 | |
---|---|---|
committer | 2015-07-08 12:54:04 -0700 | |
commit | 81793410a80b1bb147e765caccdd7fb36e34edf8 (patch) | |
tree | 29884476878efc63b5302f5ddda666d9d75fde23 /include | |
parent | 3c06511e910524bf9456c532fe20d1b2956e7d97 (diff) |
add ability to get FBO ID to Surface
BUG=skia:
Review URL: https://codereview.chromium.org/1220733007
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkSurface.h | 30 | ||||
-rw-r--r-- | include/gpu/GrRenderTarget.h | 6 |
2 files changed, 31 insertions, 5 deletions
diff --git a/include/core/SkSurface.h b/include/core/SkSurface.h index 5860cf2279..57527ed33a 100644 --- a/include/core/SkSurface.h +++ b/include/core/SkSurface.h @@ -159,11 +159,23 @@ public: */ void notifyContentWillChange(ContentChangeMode mode); - enum TextureHandleAccess { - kFlushRead_TextureHandleAccess, //!< caller may read from the texture - kFlushWrite_TextureHandleAccess, //!< caller may write to the texture - kDiscardWrite_TextureHandleAccess, //!< caller must over-write the entire texture + enum BackendHandleAccess { + kFlushRead_BackendHandleAccess, //!< caller may read from the backend object + kFlushWrite_BackendHandleAccess, //!< caller may write to the backend object + kDiscardWrite_BackendHandleAccess, //!< caller must over-write the entire backend object }; + + /* + * These are legacy aliases which will be removed soon + */ + static const BackendHandleAccess kFlushRead_TextureHandleAccess = + kFlushRead_BackendHandleAccess; + static const BackendHandleAccess kFlushWrite_TextureHandleAccess = + kFlushWrite_BackendHandleAccess; + static const BackendHandleAccess kDiscardWrite_TextureHandleAccess = + kDiscardWrite_BackendHandleAccess; + + /** * Retrieves the backend API handle of the texture used by this surface, or 0 if the surface * is not backed by a GPU texture. @@ -171,7 +183,15 @@ public: * The returned texture-handle is only valid until the next draw-call into the surface, * or the surface is deleted. */ - GrBackendObject getTextureHandle(TextureHandleAccess); + GrBackendObject getTextureHandle(BackendHandleAccess); + + /** + * Retrieves the backend API handle of the RenderTarget backing this surface. Callers must + * ensure this function returns 'true' or else the GrBackendObject will be invalid + * + * In OpenGL this will return the FramebufferObject ID. + */ + bool getRenderTargetHandle(GrBackendObject*, BackendHandleAccess); /** * Return a canvas that will draw into this surface. This will always diff --git a/include/gpu/GrRenderTarget.h b/include/gpu/GrRenderTarget.h index 67dcd4f4c2..8983d53a25 100644 --- a/include/gpu/GrRenderTarget.h +++ b/include/gpu/GrRenderTarget.h @@ -138,6 +138,12 @@ public: }; virtual ResolveType getResolveType() const = 0; + /** + * Return the native ID or handle to the rendertarget, depending on the + * platform. e.g. on OpenGL, return the FBO ID. + */ + virtual GrBackendObject getRenderTargetHandle() const = 0; + // Provides access to functions that aren't part of the public API. GrRenderTargetPriv renderTargetPriv(); const GrRenderTargetPriv renderTargetPriv() const; |