From 92098e691f10a010e7421125ba4d44c02506bb55 Mon Sep 17 00:00:00 2001 From: erikchen Date: Thu, 4 Feb 2016 12:03:07 -0800 Subject: skia: Add support for CHROMIUM_image backed textures. I created a new abstract base class TextureStorageAllocator that consumers of Skia can subclass and pass back to Skia. When a surface is created with a pointer to a TextureStorageAllocator, any textures it creates, or that are derived from the original surface, will allocate and deallocate storage using the methods on TextureStorageAllocator. BUG=https://code.google.com/p/chromium/issues/detail?id=579664 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1623653002 Review URL: https://codereview.chromium.org/1623653002 --- src/gpu/gl/GrGLTexture.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/gpu/gl/GrGLTexture.cpp') diff --git a/src/gpu/gl/GrGLTexture.cpp b/src/gpu/gl/GrGLTexture.cpp index 39a8d9279f..864547ae26 100644 --- a/src/gpu/gl/GrGLTexture.cpp +++ b/src/gpu/gl/GrGLTexture.cpp @@ -37,7 +37,13 @@ void GrGLTexture::init(const GrSurfaceDesc& desc, const IDDesc& idDesc) { void GrGLTexture::onRelease() { if (fInfo.fID) { if (GrGpuResource::kBorrowed_LifeCycle != fTextureIDLifecycle) { - GL_CALL(DeleteTextures(1, &fInfo.fID)); + if (this->desc().fTextureStorageAllocator.fDeallocateTextureStorage) { + this->desc().fTextureStorageAllocator.fDeallocateTextureStorage( + this->desc().fTextureStorageAllocator.fCtx, + reinterpret_cast(&fInfo)); + } else { + GL_CALL(DeleteTextures(1, &fInfo.fID)); + } } fInfo.fID = 0; } -- cgit v1.2.3