From e1296e295e7d4f1104d2c90b1f51d52251358bea Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Fri, 24 Jun 2016 16:42:45 +0800 Subject: tdf#100411 start the flush timer when batching (PostBatchDraw) When we batch a draw command we need to start the flush timer (if not already started) as otherwise it could happen that we won't flush the offscreen texture at the correct time or at all. This fixes a problem with drawing of pop-up "help" text. Change-Id: I6afcf173c3ac517ed0612cd413d95e28c19faa81 --- vcl/opengl/gdiimpl.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'vcl/opengl/gdiimpl.cxx') diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 3341f0fe3319..9ab939abc740 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -257,6 +257,15 @@ void OpenGLSalGraphicsImpl::PostDraw() OpenGLZone::leave(); } +void OpenGLSalGraphicsImpl::PostBatchDraw() +{ + if (IsOffscreen()) + return; + + if (!mpFlush->IsActive()) + mpFlush->Start(); +} + void OpenGLSalGraphicsImpl::ApplyProgramMatrices(float fPixelOffset) { mpProgram->ApplyMatrix(GetWidth(), GetHeight(), fPixelOffset); @@ -1265,6 +1274,7 @@ void OpenGLSalGraphicsImpl::DrawMask( OpenGLTexture& rMask, SalColor nMaskColor, void OpenGLSalGraphicsImpl::DeferredTextDraw(OpenGLTexture& rTexture, SalColor aMaskColor, const SalTwoRect& rPosAry) { mpRenderList->addDrawTextureWithMaskColor(rTexture, aMaskColor, rPosAry); + PostBatchDraw(); } bool OpenGLSalGraphicsImpl::FlushLinesOrTriangles(DrawShaderType eType, RenderParameters& rParameters) @@ -1465,24 +1475,28 @@ void OpenGLSalGraphicsImpl::drawPixel(long nX, long nY) { VCL_GL_INFO("::drawPixel: (" << nX << ", " << nY << ")"); mpRenderList->addDrawPixel(nX, nY, mnLineColor); + PostBatchDraw(); } void OpenGLSalGraphicsImpl::drawPixel(long nX, long nY, SalColor nSalColor) { VCL_GL_INFO("::drawPixel: (" << nX << ", " << nY << ")"); mpRenderList->addDrawPixel(nX, nY, nSalColor); + PostBatchDraw(); } void OpenGLSalGraphicsImpl::drawLine(long nX1, long nY1, long nX2, long nY2) { VCL_GL_INFO("::drawLine (" << nX1 << ", " << nY1 << ") (" << nX2 << ", " << nY2 << ")"); mpRenderList->addDrawLine(nX1, nY1, nX2, nY2, mnLineColor, mrParent.getAntiAliasB2DDraw()); + PostBatchDraw(); } void OpenGLSalGraphicsImpl::drawRect( long nX, long nY, long nWidth, long nHeight ) { VCL_GL_INFO("::drawRect (" << nX << ", " << nY << ") [" << nWidth << ", " << nHeight << "]"); mpRenderList->addDrawRectangle(nX, nY, nWidth, nHeight, 0.0, mnLineColor, mnFillColor); + PostBatchDraw(); } void OpenGLSalGraphicsImpl::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) @@ -1535,6 +1549,7 @@ bool OpenGLSalGraphicsImpl::drawPolyPolygon(const basegfx::B2DPolyPolygon& rPoly { VCL_GL_INFO("::drawPolyPolygon " << rPolyPolygon.getB2DRange()); mpRenderList->addDrawPolyPolygon(rPolyPolygon, fTransparency, mnLineColor, mnFillColor, mrParent.getAntiAliasB2DDraw()); + PostBatchDraw(); return true; } @@ -1546,6 +1561,7 @@ bool OpenGLSalGraphicsImpl::drawPolyLine(const basegfx::B2DPolygon& rPolygon, do mpRenderList->addDrawPolyLine(rPolygon, fTransparency, rLineWidth, eLineJoin, eLineCap, fMiterMinimumAngle, mnLineColor, mrParent.getAntiAliasB2DDraw()); + PostBatchDraw(); return true; } @@ -1661,6 +1677,7 @@ void OpenGLSalGraphicsImpl::drawMask( assert(dynamic_cast(&rSalBitmap)); const OpenGLSalBitmap& rBitmap = static_cast(rSalBitmap); mpRenderList->addDrawTextureWithMaskColor(rBitmap.GetTexture(), nMaskColor, rPosAry); + PostBatchDraw(); } SalBitmap* OpenGLSalGraphicsImpl::getBitmap( long nX, long nY, long nWidth, long nHeight ) @@ -1891,6 +1908,7 @@ bool OpenGLSalGraphicsImpl::drawAlphaRect( { VCL_GL_INFO("::drawAlphaRect (" << nX << ", " << nY << ") [" << nWidth << ", " << nHeight << "]"); mpRenderList->addDrawRectangle(nX, nY, nWidth, nHeight, double(nTransparency / 100.0), mnLineColor, mnFillColor); + PostBatchDraw(); return true; } -- cgit v1.2.3