[Libreoffice-commits] core.git: Branch 'feature/fixes15' - vcl/opengl

Michael Meeks michael.meeks at collabora.com
Tue Feb 9 17:14:47 UTC 2016


 vcl/opengl/salbmp.cxx |   24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

New commits:
commit eb5a715302bba33e140e32f904ada87b488963de
Author: Michael Meeks <michael.meeks at collabora.com>
Date:   Tue Feb 9 17:08:08 2016 +0000

    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

diff --git a/vcl/opengl/salbmp.cxx b/vcl/opengl/salbmp.cxx
index 7f0d66b..0896fd1 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()


More information about the Libreoffice-commits mailing list