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

Unified Diff: src/image/SkSurface_Gpu.cpp

Issue 1210303003: add getTextureHandle to SkSurface (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweak dox 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 fa006a61cdb4f7acf421a7fae3467ae70c063e80..34532f7cb95d4c62435f3b6c149b715c99ff2696 100644
--- a/src/image/SkSurface_Gpu.cpp
+++ b/src/image/SkSurface_Gpu.cpp
@@ -26,6 +26,24 @@ SkSurface_Gpu::~SkSurface_Gpu() {
fDevice->unref();
}
+GrBackendObject SkSurface_Gpu::onGetTextureHandle(TextureHandleAccess access) {
+ GrRenderTarget* rt = fDevice->accessRenderTarget();
+ switch (access) {
+ case kFlushRead_TextureHandleAccess:
+ rt->prepareForExternalRead(); // todo: rename to prepareForExternalAccess()
+ break;
+ case kFlushWrite_TextureHandleAccess:
+ this->notifyContentWillChange(kRetain_ContentChangeMode);
+ rt->flushWrites();
+ break;
+ case kDiscardWrite_TextureHandleAccess:
+ this->notifyContentWillChange(kDiscard_ContentChangeMode);
+ rt->discard();
+ break;
+ }
+ return rt->asTexture()->getTextureHandle();
+}
+
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