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 |