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

Unified Diff: src/image/SkSurface_Gpu.cpp

Issue 1221853003: Add SkSurface factory for wrapping an FBO in SkSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix comment 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/image/SkSurface.cpp ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkSurface_Gpu.cpp
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
index 71bed3a9b9083a70bbc1afc9603f61df66ee0ea5..ef64db576de57c09a063c1d0c0f784a150d9837c 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -117,8 +117,8 @@ SkSurface* SkSurface::NewRenderTarget(GrContext* ctx, Budgeted budgeted, const S
return SkNEW_ARGS(SkSurface_Gpu, (device));
}
-SkSurface* SkSurface::NewWrappedRenderTarget(GrContext* context, GrBackendTextureDesc desc,
- const SkSurfaceProps* props) {
+SkSurface* SkSurface::NewFromBackendTexture(GrContext* context, const GrBackendTextureDesc& desc,
+ const SkSurfaceProps* props) {
if (NULL == context) {
return NULL;
}
@@ -138,4 +138,22 @@ SkSurface* SkSurface::NewWrappedRenderTarget(GrContext* context, GrBackendTextur
return SkNEW_ARGS(SkSurface_Gpu, (device));
}
+SkSurface* SkSurface::NewFromBackendRenderTarget(GrContext* context,
+ const GrBackendRenderTargetDesc& desc,
+ const SkSurfaceProps* props) {
+ if (NULL == context) {
+ return NULL;
+ }
+ SkAutoTUnref<GrRenderTarget> rt(context->textureProvider()->wrapBackendRenderTarget(desc));
+ if (!rt) {
+ return NULL;
+ }
+ SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(rt, props,
+ SkGpuDevice::kUninit_InitContents));
+ if (!device) {
+ return NULL;
+ }
+ return SkNEW_ARGS(SkSurface_Gpu, (device));
+}
+
#endif
« no previous file with comments | « src/image/SkSurface.cpp ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698