| Index: src/image/SkSurface_Gpu.cpp
|
| diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp
|
| index b94e4e30bd07f7a097a94a151a06b9558329476b..ac2f7fe25ed15d2b1a0c0654755409d856e59cf5 100644
|
| --- a/src/image/SkSurface_Gpu.cpp
|
| +++ b/src/image/SkSurface_Gpu.cpp
|
| @@ -99,4 +99,24 @@ 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) {
|
| + if (NULL == context) {
|
| + return NULL;
|
| + }
|
| + if (!SkToBool(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) {
|
| + return NULL;
|
| + }
|
| + SkAutoTUnref<GrSurface> surface(context->wrapBackendTexture(desc));
|
| + if (!surface) {
|
| + return NULL;
|
| + }
|
| + SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(surface->asRenderTarget(), props,
|
| + SkGpuDevice::kNeedClear_Flag));
|
| + if (!device) {
|
| + return NULL;
|
| + }
|
| + return SkNEW_ARGS(SkSurface_Gpu, (device));
|
| +}
|
| +
|
| #endif
|
|
|