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

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: mac warning Created 5 years, 5 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 3a306ad3e6a882701be4b916e4dc8fe38cc81b35..67f54d5bbbab6e243dc51170f39926d299f1af39 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -26,21 +26,37 @@ 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:
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);
// legacy: need to dirty the bitmap's genID in our device (curse it)
- fDevice->fLegacyBitmap.notifyPixelsChanged();
+ surface->getDevice()->accessBitmap(false).notifyPixelsChanged();
break;
}
rt->prepareForExternalIO();
- return rt->asTexture()->getTextureHandle();
+ return rt;
+}
+
+GrBackendObject SkSurface_Gpu::onGetTextureHandle(BackendHandleAccess access) {
+ GrRenderTarget* rt = prepare_rt_for_external_access(this, access);
+ GrTexture* texture = rt->asTexture();
+ if (texture) {
+ return texture->getTextureHandle();
+ }
+ return 0;
+}
+
+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() {
« 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