diff options
Diffstat (limited to 'src/gpu/gl/GrGLGpu.cpp')
-rw-r--r-- | src/gpu/gl/GrGLGpu.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/gpu/gl/GrGLGpu.cpp b/src/gpu/gl/GrGLGpu.cpp index 7d169ff444..e85b34cab1 100644 --- a/src/gpu/gl/GrGLGpu.cpp +++ b/src/gpu/gl/GrGLGpu.cpp @@ -1038,8 +1038,12 @@ bool GrGLGpu::uploadTexData(GrPixelConfig texConfig, int texWidth, int texHeight // Rather than flip in place and alter the incoming data, // we allocate a new buffer to flip into. // This means we need to make a non-const shallow copy of texels. - SkAutoTMalloc<GrMipLevel> texelsShallowCopy(mipLevelCount); - memcpy(texelsShallowCopy.get(), texels, mipLevelCount*sizeof(GrMipLevel)); + SkAutoTMalloc<GrMipLevel> texelsShallowCopy; + + if (mipLevelCount) { + texelsShallowCopy.reset(mipLevelCount); + memcpy(texelsShallowCopy.get(), texels, mipLevelCount*sizeof(GrMipLevel)); + } for (int currentMipLevel = 0; currentMipLevel < mipLevelCount; ++currentMipLevel) { SkASSERT(texelsShallowCopy[currentMipLevel].fPixels); |