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

Unified Diff: src/image/SkSurface_Gpu.cpp

Issue 1709163003: Add wrapBackendTextureAsRenderTarget API (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: fix test Created 4 years, 10 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_Gpu.h ('k') | no next file » | 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 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
« no previous file with comments | « src/image/SkSurface_Gpu.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698