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

Unified Diff: src/gpu/gl/GrGLGpu.cpp

Issue 1187523005: Add support for creating texture backed images where Skia will delete the texture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add default param to support Chrome's current callers 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/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLInterface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/gl/GrGLGpu.cpp
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp
index 625299d58c532c756dbd726b8b07f7a44a5263e4..d0fa81d42550e0ee8393c35c6d997a3625a254e3 100644
--- a/src/gpu/gl/GrGLGpu.cpp
+++ b/src/gpu/gl/GrGLGpu.cpp
@@ -452,7 +452,8 @@ static GrSurfaceOrigin resolve_origin(GrSurfaceOrigin origin, bool renderTarget)
}
}
-GrTexture* GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc) {
+GrTexture* GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc,
+ GrWrapOwnership ownership) {
if (!this->configToGLFormats(desc.fConfig, false, NULL, NULL, NULL)) {
return NULL;
}
@@ -470,7 +471,15 @@ GrTexture* GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc) {
GrSurfaceDesc surfDesc;
idDesc.fTextureID = static_cast<GrGLuint>(desc.fTextureHandle);
- idDesc.fLifeCycle = GrGpuResource::kWrapped_LifeCycle;
+
+ switch (ownership) {
+ case kAdopt_GrWrapOwnership:
+ idDesc.fLifeCycle = GrGpuResource::kAdopted_LifeCycle;
+ break;
+ case kBorrow_GrWrapOwnership:
+ idDesc.fLifeCycle = GrGpuResource::kBorrowed_LifeCycle;
+ break;
+ }
// next line relies on GrBackendTextureDesc's flags matching GrTexture's
surfDesc.fFlags = (GrSurfaceFlags) desc.fFlags;
@@ -507,12 +516,20 @@ GrTexture* GrGLGpu::onWrapBackendTexture(const GrBackendTextureDesc& desc) {
return texture;
}
-GrRenderTarget* GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDesc& wrapDesc) {
+GrRenderTarget* GrGLGpu::onWrapBackendRenderTarget(const GrBackendRenderTargetDesc& wrapDesc,
+ GrWrapOwnership ownership) {
GrGLRenderTarget::IDDesc idDesc;
idDesc.fRTFBOID = static_cast<GrGLuint>(wrapDesc.fRenderTargetHandle);
idDesc.fMSColorRenderbufferID = 0;
idDesc.fTexFBOID = GrGLRenderTarget::kUnresolvableFBOID;
- idDesc.fLifeCycle = GrGpuResource::kWrapped_LifeCycle;
+ switch (ownership) {
+ case kAdopt_GrWrapOwnership:
+ idDesc.fLifeCycle = GrGpuResource::kAdopted_LifeCycle;
+ break;
+ case kBorrow_GrWrapOwnership:
+ idDesc.fLifeCycle = GrGpuResource::kBorrowed_LifeCycle;
+ break;
+ }
GrSurfaceDesc desc;
desc.fConfig = wrapDesc.fConfig;
« no previous file with comments | « src/gpu/gl/GrGLGpu.h ('k') | src/gpu/gl/GrGLInterface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698