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

Unified Diff: src/image/SkSurface_Gpu.cpp

Issue 1220733007: add ability to get FBO ID to Surface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweaks 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_Gpu.h ('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..8bf30ad91ee114d215608b64ac4859955f4fc816 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -26,22 +26,34 @@ SkSurface_Gpu::~SkSurface_Gpu() {
fDevice->unref();
}
-GrBackendObject SkSurface_Gpu::onGetTextureHandle(TextureHandleAccess access) {
- GrRenderTarget* rt = fDevice->accessRenderTarget();
+static GrRenderTarget* prepare_rt_for_external_access(SkSurface_Gpu* surface,
+ SkSurface::BackendHandleAccess access) {
+ GrRenderTarget* rt = surface->getDevice()->accessRenderTarget();
switch (access) {
- case kFlushRead_TextureHandleAccess:
+ case SkSurface::kFlushRead_BackendHandleAccess:
rt->prepareForExternalRead(); // todo: rename to prepareForExternalAccess()
break;
- case kFlushWrite_TextureHandleAccess:
- case kDiscardWrite_TextureHandleAccess:
+ case SkSurface::kFlushWrite_BackendHandleAccess:
+ case SkSurface::kDiscardWrite_BackendHandleAccess:
// for now we don't special-case on Discard, but we may in the future.
- this->notifyContentWillChange(kRetain_ContentChangeMode);
+ surface->notifyContentWillChange(SkSurface::kRetain_ContentChangeMode);
rt->flushWrites();
break;
}
+ return rt;
+}
+
+GrBackendObject SkSurface_Gpu::onGetTextureHandle(BackendHandleAccess access) {
+ GrRenderTarget* rt = prepare_rt_for_external_access(this, access);
return rt->asTexture()->getTextureHandle();
bsalomon 2015/06/30 15:49:58 Eek... this is an existing bug I should have caugh
}
+bool SkSurface_Gpu::onGetRenderTargetHandle(GrBackendObject* obj, BackendHandleAccess access) {
+ GrRenderTarget* rt = prepare_rt_for_external_access(this, access);
+ *obj = rt->getRenderTargetHandle();
+ return true;
+}
+
SkCanvas* SkSurface_Gpu::onNewCanvas() {
SkCanvas::InitFlags flags = SkCanvas::kDefault_InitFlags;
// When we think this works...
« no previous file with comments | « src/image/SkSurface_Gpu.h ('k') | tests/SurfaceTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698