[Libreoffice-commits] core.git: 3 commits - vcl/opengl vcl/source vcl/win

Jan Holesovsky kendy at collabora.com
Fri Mar 20 06:11:00 PDT 2015


 vcl/opengl/gdiimpl.cxx           |   20 ++++++++++++++++++++
 vcl/source/app/svmain.cxx        |    9 ---------
 vcl/win/source/gdi/winlayout.cxx |    4 +++-
 3 files changed, 23 insertions(+), 10 deletions(-)

New commits:
commit 8daa8ba3ae3503ce579179b7fbe3a7ef276af5ab
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Mar 20 13:42:56 2015 +0100

    opengl: More checking for GL errors.
    
    Change-Id: I3bd9b63f7dbfdc5b93202e57385f6136d667878b

diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 5ed9db6..351fc1d 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -455,6 +455,8 @@ void OpenGLSalGraphicsImpl::DrawPoint( long nX, long nY )
 
     mpProgram->SetVertices( pPoint );
     glDrawArrays( GL_POINTS, 0, 1 );
+
+    CHECK_GL_ERROR();
 }
 
 void OpenGLSalGraphicsImpl::DrawLine( double nX1, double nY1, double nX2, double nY2 )
@@ -468,6 +470,8 @@ void OpenGLSalGraphicsImpl::DrawLine( double nX1, double nY1, double nX2, double
 
     mpProgram->SetVertices( pPoints );
     glDrawArrays( GL_LINES, 0, 2 );
+
+    CHECK_GL_ERROR();
 }
 
 void OpenGLSalGraphicsImpl::DrawLineAA( double nX1, double nY1, double nX2, double nY2 )
@@ -493,6 +497,8 @@ void OpenGLSalGraphicsImpl::DrawLineAA( double nX1, double nY1, double nX2, doub
         return;
     }
     ImplDrawLineAA( nX1, nY1, nX2, nY2 );
+
+    CHECK_GL_ERROR();
 }
 
 void OpenGLSalGraphicsImpl::ImplDrawLineAA( double nX1, double nY1, double nX2, double nY2, bool edge )
@@ -632,6 +638,8 @@ void OpenGLSalGraphicsImpl::ImplDrawLineAA( double nX1, double nY1, double nX2,
     mpProgram->SetTextureCoord( aTexCoord );
     mpProgram->SetVertices( vertices );
     glDrawArrays(GL_TRIANGLE_STRIP, 0, 8);
+
+    CHECK_GL_ERROR();
 }
 
 void OpenGLSalGraphicsImpl::DrawLines( sal_uInt32 nPoints, const SalPoint* pPtAry, bool bClose )
@@ -694,6 +702,8 @@ void OpenGLSalGraphicsImpl::DrawConvexPolygon( sal_uInt32 nPoints, const SalPoin
             UseSolid( lastSolidColor, lastSolidTransparency );
         }
     }
+
+    CHECK_GL_ERROR();
 }
 
 void OpenGLSalGraphicsImpl::DrawConvexPolygon( const Polygon& rPolygon, bool blockAA )
@@ -734,6 +744,8 @@ void OpenGLSalGraphicsImpl::DrawConvexPolygon( const Polygon& rPolygon, bool blo
             UseSolid( lastSolidColor, lastSolidTransparency );
         }
     }
+
+    CHECK_GL_ERROR();
 }
 
 void OpenGLSalGraphicsImpl::DrawTrapezoid( const basegfx::B2DTrapezoid& trapezoid, bool blockAA )
@@ -775,6 +787,8 @@ void OpenGLSalGraphicsImpl::DrawTrapezoid( const basegfx::B2DTrapezoid& trapezoi
             UseSolid( lastSolidColor, lastSolidTransparency );
         }
     }
+
+    CHECK_GL_ERROR();
 }
 
 void OpenGLSalGraphicsImpl::DrawRect( long nX, long nY, long nWidth, long nHeight )
@@ -863,6 +877,8 @@ void OpenGLSalGraphicsImpl::DrawRegionBand( const RegionBand& rRegion )
 
     mpProgram->SetVertices( &aVertices[0] );
     glDrawArrays( GL_TRIANGLES, 0, aVertices.size() / 2 );
+
+    CHECK_GL_ERROR();
 }
 
 void OpenGLSalGraphicsImpl::DrawTextureRect( OpenGLTexture& rTexture, const SalTwoRect& rPosAry, bool bInverted )
@@ -970,6 +986,8 @@ void OpenGLSalGraphicsImpl::DrawTransformedTexture(
     mpProgram->SetVertices( &aVertices[0] );
     glDrawArrays( GL_TRIANGLE_FAN, 0, 4 );
     mpProgram->Clean();
+
+    CHECK_GL_ERROR();
 }
 
 void OpenGLSalGraphicsImpl::DrawAlphaTexture( OpenGLTexture& rTexture, const SalTwoRect& rPosAry, bool bInverted, bool bPremultiplied )
@@ -1800,6 +1818,8 @@ void OpenGLSalGraphicsImpl::endPaint()
         mpContext->AcquireDefaultFramebuffer();
         glFlush();
     }
+
+    CHECK_GL_ERROR();
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 7af678178e92c6e7cb419891160263cb04edea28
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Mar 20 08:33:01 2015 +0100

    opengl dr.memory: Avoid double delete.
    
    The context is deleted via OpenGLSalGraphicsImpl::~OpenGLSalGraphicsImpl later,
    doing it already here leads to a double delete and a crash.
    
    Change-Id: Icf1bed81501b5ac67ef60901eaa73e5ee5540a9f

diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx
index 1f597e5..fdf2b9f 100644
--- a/vcl/source/app/svmain.cxx
+++ b/vcl/source/app/svmain.cxx
@@ -442,15 +442,6 @@ void DeInitVCL()
     }
     if ( pSVData->mpDefaultWin )
     {
-        OpenGLContext* pContext = pSVData->mpDefaultWin->GetGraphics()->GetOpenGLContext();
-        if( pContext )
-        {
-#ifdef DBG_UTIL
-            pContext->DeRef(NULL);
-#else
-            pContext->DeRef();
-#endif
-        }
         delete pSVData->mpDefaultWin;
         pSVData->mpDefaultWin = NULL;
     }
commit ff51dcfcf2aeb1efd6dc94010ea646b13d697b1a
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Mar 20 06:31:02 2015 +0100

    opengl dr.memory: DC that contains selected object being deleted.
    
    Change-Id: Id9922606207c2c45ed982b6ee4b46388ea660ea5

diff --git a/vcl/win/source/gdi/winlayout.cxx b/vcl/win/source/gdi/winlayout.cxx
index 7114db2..3e7bb08 100644
--- a/vcl/win/source/gdi/winlayout.cxx
+++ b/vcl/win/source/gdi/winlayout.cxx
@@ -198,7 +198,7 @@ void WinLayout::DrawText(SalGraphics& rGraphics) const
 
         // setup the hidden DC with black color and white background, we will
         // use the result of the text drawing later as a mask only
-        SelectFont(aDC.getCompatibleHDC(), mhFont);
+        HFONT hOrigFont = SelectFont(aDC.getCompatibleHDC(), mhFont);
 
         SetTextColor(aDC.getCompatibleHDC(), RGB(0, 0, 0));
         SetBkColor(aDC.getCompatibleHDC(), RGB(255, 255, 255));
@@ -223,6 +223,8 @@ void WinLayout::DrawText(SalGraphics& rGraphics) const
 
             pImpl->PostDraw();
         }
+
+        SelectFont(aDC.getCompatibleHDC(), hOrigFont);
     }
 }
 


More information about the Libreoffice-commits mailing list