summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2016-02-09 17:08:08 +0000
committerMichael Meeks <michael.meeks@collabora.com>2016-02-09 23:48:53 +0000
commit432328f19bea0aa14a2b09a701c5b3aaf1f93908 (patch)
tree905621590f07429bf8a70b334ebda6d062f776c1 /vcl
parent5f2db838a0bbadc9e0f710237a39dde231a138f2 (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> (cherry picked from commit 77841b211fe7e4bdb6511333236ba4b86fac908f) Reviewed-on: https://gerrit.libreoffice.org/22247 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/opengl/salbmp.cxx24
1 files changed, 8 insertions, 16 deletions
diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index 7f0d66befdd5..0896fd1a8070 100644
--- a/vcl/opengl/salbmp.cxx
+++ b/vcl/opengl/salbmp.cxx
@@ -596,7 +596,6 @@ bool OpenGLSalBitmap::calcChecksumGL(OpenGLTexture& rInputTexture, ChecksumType&
{
OUString FragShader("areaHashCRC64TFragmentShader");
- OpenGLZone aZone;
rtl::Reference< OpenGLContext > xContext = OpenGLContext::getVCLContext();
static vcl::DeleteOnDeinit<OpenGLTexture> gCRCTableTexture(
@@ -631,7 +630,6 @@ bool OpenGLSalBitmap::calcChecksumGL(OpenGLTexture& rInputTexture, ChecksumType&
CHECK_GL_ERROR();
-
// Second Pass
nWidth = aFirstPassTexture.GetWidth();
@@ -675,25 +673,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()