Index: src/image/SkSurface_Gpu.cpp |
diff --git a/src/image/SkSurface_Gpu.cpp b/src/image/SkSurface_Gpu.cpp |
index 24ac6d33124b82a237f3bfffd6a07d25bcdb8e64..07d6f24dd30e3af23b69a3bc27776e3810e2581a 100644 |
--- a/src/image/SkSurface_Gpu.cpp |
+++ b/src/image/SkSurface_Gpu.cpp |
@@ -7,6 +7,7 @@ |
#include "SkSurface_Gpu.h" |
+#include "GrResourceProvider.h" |
#include "SkCanvas.h" |
#include "SkGpuDevice.h" |
#include "SkImage_Base.h" |
@@ -108,6 +109,10 @@ void SkSurface_Gpu::onDiscard() { |
fDevice->accessRenderTarget()->discard(); |
} |
+void SkSurface_Gpu::onPrepareForExternalIO() { |
+ fDevice->accessRenderTarget()->prepareForExternalIO(); |
+} |
+ |
/////////////////////////////////////////////////////////////////////////////// |
SkSurface* SkSurface::NewRenderTargetDirect(GrRenderTarget* target, const SkSurfaceProps* props) { |
@@ -170,4 +175,23 @@ SkSurface* SkSurface::NewFromBackendRenderTarget(GrContext* context, |
return new SkSurface_Gpu(device); |
} |
+SkSurface* SkSurface::NewFromBackendTextureAsRenderTarget(GrContext* context, |
+ const GrBackendTextureDesc& desc, |
+ const SkSurfaceProps* props) { |
+ if (nullptr == context) { |
+ return nullptr; |
+ } |
+ SkAutoTUnref<GrRenderTarget> rt( |
+ context->resourceProvider()->wrapBackendTextureAsRenderTarget(desc)); |
+ if (!rt) { |
+ return nullptr; |
+ } |
+ SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(rt, props, |
+ SkGpuDevice::kUninit_InitContents)); |
+ if (!device) { |
+ return nullptr; |
+ } |
+ return new SkSurface_Gpu(device); |
+} |
+ |
#endif |