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... |