include/vcl/outdev.hxx | 4 +++- vcl/inc/generic/genpspgraphics.h | 3 ++- vcl/inc/headless/svpgdi.hxx | 3 ++- vcl/inc/openglgdiimpl.hxx | 4 +++- vcl/inc/quartz/salgdi.h | 3 ++- vcl/inc/salgdi.hxx | 3 ++- vcl/inc/salgdiimpl.hxx | 3 ++- vcl/inc/unx/salgdi.h | 3 ++- vcl/inc/win/salgdi.h | 3 ++- vcl/opengl/gdiimpl.cxx | 25 +++++++++++++++++++------ vcl/source/opengl/OpenGLHelper.cxx | 1 - vcl/source/outdev/outdev.cxx | 13 +++++++++---- vcl/source/window/paint.cxx | 7 +++++-- vcl/unx/generic/gdi/gdiimpl.hxx | 3 ++- vcl/unx/generic/gdi/salgdi.cxx | 9 +++++++-- vcl/win/source/gdi/gdiimpl.hxx | 3 ++- vcl/win/source/gdi/salgdi.cxx | 9 +++++++-- 17 files changed, 71 insertions(+), 28 deletions(-)
New commits: commit 309a589ccc4ab2f1cbb9d8d58a50a8f7aafcbcba Author: Louis-Francis Ratté-Boulianne <l...@collabora.com> Date: Wed Nov 12 12:46:22 2014 -0500 vcl: Fix the masked texture program attributes binding Change-Id: Ie7440881f35eaf348aef35beea5a6d407d16a342 diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index c4c2930..393930f 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -285,8 +285,8 @@ bool OpenGLSalGraphicsImpl::CreateMaskedTextureProgram( void ) if( mnMaskedTextureProgram == 0 ) return false; - glBindAttribLocation( mnTextureProgram, GL_ATTRIB_POS, "position" ); - glBindAttribLocation( mnTextureProgram, GL_ATTRIB_TEX, "tex_coord_in" ); + glBindAttribLocation( mnMaskedTextureProgram, GL_ATTRIB_POS, "position" ); + glBindAttribLocation( mnMaskedTextureProgram, GL_ATTRIB_TEX, "tex_coord_in" ); mnMaskedSamplerUniform = glGetUniformLocation( mnMaskedTextureProgram, "sampler" ); mnMaskSamplerUniform = glGetUniformLocation( mnMaskedTextureProgram, "mask" ); commit 128a96a10ad04d7f646f433eef3e004c13fdb906 Author: Louis-Francis Ratté-Boulianne <l...@collabora.com> Date: Wed Nov 12 12:45:36 2014 -0500 vcl: Use single-buffer rendering and only flush when necessary Change-Id: I832dd6f3647fbb423975fa928a5ec32447225e85 diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 5070a5f..cff245c 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -518,7 +518,9 @@ public: const Point& rSrcPt, const Size& rSrcSize, sal_uInt16 nFlags = 0 ); - virtual bool SwapBuffers(); + // Call before and after a paint operation to reduce flushing + virtual void BeginPaint(); + virtual void EndPaint(); protected: diff --git a/vcl/inc/generic/genpspgraphics.h b/vcl/inc/generic/genpspgraphics.h index fb7169a..882e475 100644 --- a/vcl/inc/generic/genpspgraphics.h +++ b/vcl/inc/generic/genpspgraphics.h @@ -193,7 +193,8 @@ public: virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE; virtual SystemFontData GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE; - virtual bool SwapBuffers() SAL_OVERRIDE { return false; }; + virtual void BeginPaint() SAL_OVERRIDE { }; + virtual void EndPaint() SAL_OVERRIDE { }; }; #endif // INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index cd5622f..9f2604f 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -243,7 +243,8 @@ public: virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE; virtual SystemFontData GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE; - virtual bool SwapBuffers() SAL_OVERRIDE { return false; }; + virtual void BeginPaint() SAL_OVERRIDE { }; + virtual void EndPaint() SAL_OVERRIDE { }; #ifdef IOS void SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContext, int = 0 ); diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx index f80c969..3d1c585 100644 --- a/vcl/inc/openglgdiimpl.hxx +++ b/vcl/inc/openglgdiimpl.hxx @@ -38,6 +38,7 @@ protected: OpenGLContext maContext; SalFrame* mpFrame; SalVirtualDevice* mpVDev; + int mnPainting; bool mbOffscreen; GLuint mnFramebufferId; @@ -285,7 +286,8 @@ public: virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) SAL_OVERRIDE; - virtual bool swapBuffers() SAL_OVERRIDE; + virtual void beginPaint() SAL_OVERRIDE; + virtual void endPaint() SAL_OVERRIDE; private: }; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index caab577..6cc4526 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -394,7 +394,8 @@ public: GetGraphicsData() const SAL_OVERRIDE; virtual SystemFontData GetSysFontData( int /* nFallbacklevel */ ) const SAL_OVERRIDE; - virtual bool SwapBuffers() SAL_OVERRIDE { return false; }; + virtual void BeginPaint() SAL_OVERRIDE { }; + virtual void EndPaint() SAL_OVERRIDE { }; private: // differences between VCL, Quartz and kHiThemeOrientation coordinate systems diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index a3917bb..2453450 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -412,7 +412,8 @@ public: sal_uInt8 nTransparency, const OutputDevice *pOutDev ); - virtual bool SwapBuffers() = 0; + virtual void BeginPaint() = 0; + virtual void EndPaint() = 0; virtual SystemGraphicsData GetGraphicsData() const = 0; diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx index 4b4b735..09ea28f 100644 --- a/vcl/inc/salgdiimpl.hxx +++ b/vcl/inc/salgdiimpl.hxx @@ -207,7 +207,8 @@ public: virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) = 0; - virtual bool swapBuffers() = 0; + virtual void beginPaint() = 0; + virtual void endPaint() = 0; }; #endif diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h index d532668..743fc5d 100644 --- a/vcl/inc/unx/salgdi.h +++ b/vcl/inc/unx/salgdi.h @@ -269,7 +269,8 @@ public: virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE; virtual SystemFontData GetSysFontData( int nFallbackLevel ) const SAL_OVERRIDE; - virtual bool SwapBuffers() SAL_OVERRIDE; + virtual void BeginPaint() SAL_OVERRIDE; + virtual void EndPaint() SAL_OVERRIDE; // create a pixmap from a screen region X11Pixmap* GetPixmapFromScreen( const Rectangle& rRect ); diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index f09af28..69ea4cf 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -397,7 +397,8 @@ public: virtual SystemGraphicsData GetGraphicsData() const; virtual SystemFontData GetSysFontData( int nFallbacklevel ) const; - virtual bool SwapBuffers() SAL_OVERRIDE; + virtual void BeginPaint() SAL_OVERRIDE; + virtual void EndPaint() SAL_OVERRIDE; /// Update settings based on the platform values static void updateSettingsNative( AllSettings& rSettings ); diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 9d49597..c4c2930 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -60,6 +60,7 @@ OpenGLSalGraphicsImpl::OpenGLSalGraphicsImpl() : mpFrame(NULL) + , mnPainting(0) , mbOffscreen(false) , mnFramebufferId(0) , mpOffscreenTex(NULL) @@ -104,7 +105,8 @@ void OpenGLSalGraphicsImpl::PostDraw() { if( mbOffscreen ) glBindFramebuffer( GL_FRAMEBUFFER, 0 ); - + if( mnPainting == 0 ) + glFlush(); CHECK_GL_ERROR(); } @@ -1343,10 +1345,21 @@ bool OpenGLSalGraphicsImpl::drawGradient(const tools::PolyPolygon& rPolyPoly, return false; } -bool OpenGLSalGraphicsImpl::swapBuffers() +void OpenGLSalGraphicsImpl::beginPaint() { - maContext.swapBuffers(); - return true; + mnPainting++; + SAL_INFO( "vcl.opengl", "BEGIN PAINT " << this ); +} + +void OpenGLSalGraphicsImpl::endPaint() +{ + mnPainting--; + SAL_INFO( "vcl.opengl", "END PAINT " << this ); + if( mnPainting == 0 ) + { + maContext.makeCurrent(); + glFlush(); + } } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index d9f445d..a6073c4 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -387,7 +387,6 @@ bool OpenGLHelper::GetVisualInfo(Display* pDisplay, int nScreen, XVisualInfo& rV GLX_GREEN_SIZE, 8, GLX_BLUE_SIZE, 8, GLX_DEPTH_SIZE, 24, - GLX_DOUBLEBUFFER, None }; pVI = glXChooseVisual( pDisplay, nScreen, aAttrib ); diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index 2ce3762..8821ba6 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -897,11 +897,16 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, return bDrawn; } -bool OutputDevice::SwapBuffers() +void OutputDevice::BeginPaint() { - if( !mpGraphics && !AcquireGraphics() ) - return false; - return mpGraphics->SwapBuffers(); + if( mpGraphics || AcquireGraphics() ) + mpGraphics->BeginPaint(); +} + +void OutputDevice::EndPaint() +{ + if( mpGraphics || AcquireGraphics() ) + mpGraphics->EndPaint(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index e5cc31a..061cf2d 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -120,8 +120,10 @@ void PaintHelper::DoPaint(const vcl::Region* pRegion) pWindowImpl->mnPaintFlags = 0; if ( !pWindowImpl->maInvalidateRegion.IsEmpty() ) { + m_pWindow->BeginPaint(); m_pWindow->PushPaintHelper(this); m_pWindow->Paint(m_aPaintRect); + m_pWindow->EndPaint(); } } @@ -277,9 +279,10 @@ void Window::ImplCallOverlapPaint() { // - RTL - notify ImplCallPaint to check for re-mirroring (CHECKRTL) // because we were called from the Sal layer - ImplCallPaint( NULL, mpWindowImpl->mnPaintFlags /*| IMPL_PAINT_CHECKRTL */); OutputDevice *pOutDev = GetOutDev(); - pOutDev->SwapBuffers(); + pOutDev->BeginPaint(); + ImplCallPaint( NULL, mpWindowImpl->mnPaintFlags /*| IMPL_PAINT_CHECKRTL */); + pOutDev->EndPaint(); } } diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx index 5b0062c..fed9bc6 100644 --- a/vcl/unx/generic/gdi/gdiimpl.hxx +++ b/vcl/unx/generic/gdi/gdiimpl.hxx @@ -267,7 +267,8 @@ public: virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) SAL_OVERRIDE; - virtual bool swapBuffers() SAL_OVERRIDE { return false; } + virtual void beginPaint() SAL_OVERRIDE { } + virtual void endPaint() SAL_OVERRIDE { } public: // implementation of X11GraphicsImpl diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index 9609ec8..62e8989 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -471,9 +471,14 @@ bool X11SalGraphics::drawGradient(const tools::PolyPolygon& rPoly, const Gradien return mpImpl->drawGradient(rPoly, rGradient); } -bool X11SalGraphics::SwapBuffers() +void X11SalGraphics::BeginPaint() { - return mpImpl->swapBuffers(); + return mpImpl->beginPaint(); +} + +void X11SalGraphics::EndPaint() +{ + return mpImpl->endPaint(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/gdi/gdiimpl.hxx b/vcl/win/source/gdi/gdiimpl.hxx index cfef58a..852764d 100644 --- a/vcl/win/source/gdi/gdiimpl.hxx +++ b/vcl/win/source/gdi/gdiimpl.hxx @@ -217,7 +217,8 @@ public: virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) SAL_OVERRIDE; - virtual bool swapBuffers() SAL_OVERRIDE { return false; } + virtual void beginPaint() SAL_OVERRIDE { } + virtual void endPaint() SAL_OVERRIDE { } }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx index 4543489..fa85420 100644 --- a/vcl/win/source/gdi/salgdi.cxx +++ b/vcl/win/source/gdi/salgdi.cxx @@ -1027,9 +1027,14 @@ SystemGraphicsData WinSalGraphics::GetGraphicsData() const return aRes; } -bool WinSalGraphics::SwapBuffers() +void WinSalGraphics::BeginPaint() { - return mpImpl->swapBuffers(); + return mpImpl->beginPaint(); +} + +void WinSalGraphics::BeginPaint() +{ + return mpImpl->endPaint(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits