Index: src/gpu/GrGpu.cpp |
diff --git a/src/gpu/GrGpu.cpp b/src/gpu/GrGpu.cpp |
index e7adf0b3219ae8c2f55165042342f92afdc53d83..4fcd4d57af0a23b7f7c316c813fd7c25b942db38 100644 |
--- a/src/gpu/GrGpu.cpp |
+++ b/src/gpu/GrGpu.cpp |
@@ -166,6 +166,10 @@ GrTexture* GrGpu::wrapBackendTexture(const GrBackendTextureDesc& desc, GrWrapOwn |
!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { |
return nullptr; |
} |
+ int maxSize = this->caps()->maxTextureSize(); |
+ if (desc.fWidth > maxSize || desc.fHeight > maxSize) { |
+ return nullptr; |
+ } |
GrTexture* tex = this->onWrapBackendTexture(desc, ownership); |
if (nullptr == tex) { |
return nullptr; |
@@ -189,6 +193,22 @@ GrRenderTarget* GrGpu::wrapBackendRenderTarget(const GrBackendRenderTargetDesc& |
return this->onWrapBackendRenderTarget(desc, ownership); |
} |
+GrRenderTarget* GrGpu::wrapBackendTextureAsRenderTarget(const GrBackendTextureDesc& desc, |
+ GrWrapOwnership ownership) { |
+ this->handleDirtyContext(); |
+ if (!(desc.fFlags & kRenderTarget_GrBackendTextureFlag)) { |
+ return nullptr; |
+ } |
+ if (!this->caps()->isConfigRenderable(desc.fConfig, desc.fSampleCnt > 0)) { |
+ return nullptr; |
+ } |
+ int maxSize = this->caps()->maxTextureSize(); |
+ if (desc.fWidth > maxSize || desc.fHeight > maxSize) { |
+ return nullptr; |
+ } |
+ return this->onWrapBackendTextureAsRenderTarget(desc, ownership); |
+} |
+ |
GrVertexBuffer* GrGpu::createVertexBuffer(size_t size, bool dynamic) { |
this->handleDirtyContext(); |
GrVertexBuffer* vb = this->onCreateVertexBuffer(size, dynamic); |