diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2016-02-09 17:08:08 +0000 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2016-02-09 18:26:34 +0000 |
commit | 77841b211fe7e4bdb6511333236ba4b86fac908f (patch) | |
tree | 8e9ddba7436e274c5381abaf19b23471887cb096 /vcl | |
parent | e6421b3e221405ea02c12226da6349a563bfd0ec (diff) |
vcl: opengl - fix crashing / memory corrupting issues with updateChecksum.
Switch to use GetTexture which is robust over a number of corner-cases.
Also ensure that we have a valid VCL OpenGLContext.
Change-Id: I79b2b8ee241da4ed79e93e30df005e8c32ffcf02
Reviewed-on: https://gerrit.libreoffice.org/22242
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Tested-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/opengl/salbmp.cxx | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx index 683ca5fe5ac0..cacd15786c9c 100644 --- a/vcl/opengl/salbmp.cxx +++ b/vcl/opengl/salbmp.cxx @@ -598,7 +598,6 @@ bool OpenGLSalBitmap::calcChecksumGL(OpenGLTexture& rInputTexture, ChecksumType& { OUString FragShader("areaHashCRC64TFragmentShader"); - OpenGLZone aZone; rtl::Reference< OpenGLContext > xContext = OpenGLContext::getVCLContext(); static vcl::DeleteOnDeinit<OpenGLTexture> gCRCTableTexture( @@ -633,7 +632,6 @@ bool OpenGLSalBitmap::calcChecksumGL(OpenGLTexture& rInputTexture, ChecksumType& CHECK_GL_ERROR(); - // Second Pass nWidth = aFirstPassTexture.GetWidth(); @@ -677,25 +675,19 @@ void OpenGLSalBitmap::updateChecksum() const if (mbChecksumValid) return; - OpenGLSalBitmap* pThis = const_cast<OpenGLSalBitmap*>(this); - - if (!mbDirtyTexture) + if( (mnWidth * mnHeight) < (1024*768) || mnWidth < 128 || mnHeight < 128 ) { - pThis->CreateTexture(); + SalBitmap::updateChecksum(); + return; } - OpenGLTexture& rInputTexture = pThis->maTexture; - int nWidth = rInputTexture.GetWidth(); - int nHeight = rInputTexture.GetHeight(); + OpenGLSalBitmap* pThis = const_cast<OpenGLSalBitmap*>(this); - if( (nWidth * nHeight) < (1024*768) || nWidth < 128 || nHeight < 128 ) - { + OpenGLVCLContextZone aContextZone; + OpenGLTexture& rInputTexture = GetTexture(); + pThis->mbChecksumValid = calcChecksumGL(rInputTexture, pThis->mnChecksum); + if (!pThis->mbChecksumValid) SalBitmap::updateChecksum(); - } - else - { - pThis->mbChecksumValid = calcChecksumGL(rInputTexture, pThis->mnChecksum); - } } rtl::Reference<OpenGLContext> OpenGLSalBitmap::GetBitmapContext() |