diff options
author | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-10-30 15:18:10 +0000 |
---|---|---|
committer | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-10-30 15:18:10 +0000 |
commit | b72e5d31383464171c01370c09cdbba77707e8ef (patch) | |
tree | ef9d14051381fd2bbc641e95df405f2562195c3d /src/gpu | |
parent | 5682f21f99f45026f87a823bdc9eb4fb418b725e (diff) |
Add GL texture validity check to GrGpuGL
https://codereview.appspot.com/6817053/
git-svn-id: http://skia.googlecode.com/svn/trunk@6200 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu')
-rw-r--r-- | src/gpu/gl/GrGpuGL.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp index 04d0f8eb71..1d622bf027 100644 --- a/src/gpu/gl/GrGpuGL.cpp +++ b/src/gpu/gl/GrGpuGL.cpp @@ -477,11 +477,20 @@ void GrGpuGL::onResetContext() { } GrTexture* GrGpuGL::onWrapBackendTexture(const GrBackendTextureDesc& desc) { - GrGLTexture::Desc glTexDesc; if (!this->configToGLFormats(desc.fConfig, false, NULL, NULL, NULL)) { return NULL; } + if (0 == desc.fTextureHandle) { + return NULL; + } + + int maxSize = this->getCaps().maxTextureSize(); + if (desc.fWidth > maxSize || desc.fHeight > maxSize) { + return NULL; + } + + GrGLTexture::Desc glTexDesc; // next line relies on GrBackendTextureDesc's flags matching GrTexture's glTexDesc.fFlags = (GrTextureFlags) desc.fFlags; glTexDesc.fWidth = desc.fWidth; |