include/vcl/opengl/OpenGLHelper.hxx | 10 ++++++++++ include/vcl/outdev.hxx | 2 ++ vcl/inc/generic/genpspgraphics.h | 2 ++ vcl/inc/headless/svpgdi.hxx | 2 ++ vcl/inc/openglgdiimpl.hxx | 2 ++ vcl/inc/quartz/salgdi.h | 2 ++ vcl/inc/salgdi.hxx | 2 ++ vcl/inc/salgdiimpl.hxx | 2 ++ vcl/inc/unx/salgdi.h | 2 ++ vcl/inc/win/salgdi.h | 2 ++ vcl/opengl/gdiimpl.cxx | 6 ++++++ vcl/source/opengl/OpenGLContext.cxx | 14 +++++++++++++- vcl/source/opengl/OpenGLHelper.cxx | 25 +++++++++++++++++++++++++ vcl/source/outdev/outdev.cxx | 7 +++++++ vcl/source/window/paint.cxx | 2 ++ vcl/unx/generic/app/saldisp.cxx | 8 ++++++++ vcl/unx/generic/gdi/gdiimpl.hxx | 2 ++ vcl/unx/generic/gdi/salgdi.cxx | 5 +++++ 18 files changed, 96 insertions(+), 1 deletion(-)
New commits: commit 5c7b4ea3bdf05b4c80082e5737c34c8d1871ae99 Author: Louis-Francis Ratté-Boulianne <l...@collabora.com> Date: Tue Nov 4 17:32:48 2014 -0500 vcl: Add list of contexts sharing the same display list Change-Id: Ib1bca0aaaf41140d6b9a17378094b0f20e469ebd diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx index 6b995b2..7babaf5 100644 --- a/vcl/source/opengl/OpenGLContext.cxx +++ b/vcl/source/opengl/OpenGLContext.cxx @@ -25,6 +25,8 @@ using namespace com::sun::star; +static std::vector< GLXContext > vShareList; + GLWindow::~GLWindow() { #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID @@ -56,6 +58,8 @@ OpenGLContext::~OpenGLContext() #elif defined( UNX ) if(m_aGLWin.ctx) { + std::remove( vShareList.begin(), vShareList.end(), m_aGLWin.ctx ); + glXMakeCurrent(m_aGLWin.dpy, None, NULL); if( glGetError() != GL_NO_ERROR ) { @@ -547,13 +551,21 @@ bool OpenGLContext::ImplInit() #endif if (!m_aGLWin.ctx) { + GLXContext pSharedCtx( NULL ); + if (!m_aGLWin.dpy || !m_aGLWin.vi) return false; + if( !vShareList.empty() ) + pSharedCtx = vShareList.front(); + m_aGLWin.ctx = m_aGLWin.dpy == 0 ? 0 : glXCreateContext(m_aGLWin.dpy, m_aGLWin.vi, - 0, + pSharedCtx, GL_TRUE); + + if( m_aGLWin.ctx ) + vShareList.push_back( m_aGLWin.ctx ); } if( m_aGLWin.ctx == NULL ) { commit efbf76b57ffc514ba307418dbf6a34a3ed20319f Author: Louis-Francis Ratté-Boulianne <l...@collabora.com> Date: Tue Nov 4 17:31:12 2014 -0500 vcl: Get visual info for window from GLX when needed Change-Id: Id8cea87391835694e20aa703b7fdb3f13434d47b diff --git a/include/vcl/opengl/OpenGLHelper.hxx b/include/vcl/opengl/OpenGLHelper.hxx index 8c04e32..092d7f4 100644 --- a/include/vcl/opengl/OpenGLHelper.hxx +++ b/include/vcl/opengl/OpenGLHelper.hxx @@ -16,6 +16,12 @@ #include <rtl/ustring.hxx> +#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID +# include <prex.h> +# include "GL/glxew.h" +# include <postx.h> +#endif + class VCLOPENGL_DLLPUBLIC OpenGLHelper { public: @@ -46,6 +52,10 @@ public: static float getGLVersion(); static void checkGLError(const char* aFile, size_t nLine); + +#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID + static bool GetVisualInfo(Display* pDisplay, int nScreen, XVisualInfo& rVI); +#endif }; #define CHECK_GL_ERROR() OpenGLHelper::checkGLError(__FILE__, __LINE__) diff --git a/vcl/source/opengl/OpenGLHelper.cxx b/vcl/source/opengl/OpenGLHelper.cxx index c94e290..4e4b3d1 100644 --- a/vcl/source/opengl/OpenGLHelper.cxx +++ b/vcl/source/opengl/OpenGLHelper.cxx @@ -358,4 +358,29 @@ void OpenGLHelper::checkGLError(const char* pFile, size_t nLine) } } +#if defined UNX && !defined MACOSX && !defined IOS && !defined ANDROID + +bool OpenGLHelper::GetVisualInfo(Display* pDisplay, int nScreen, XVisualInfo& rVI) +{ + XVisualInfo* pVI; + int aAttrib[] = { GLX_RGBA, + GLX_RED_SIZE, 8, + GLX_GREEN_SIZE, 8, + GLX_BLUE_SIZE, 8, + GLX_DEPTH_SIZE, 24, + GLX_DOUBLEBUFFER, + None }; + + pVI = glXChooseVisual( pDisplay, nScreen, aAttrib ); + if( !pVI ) + return false; + + rVI = *pVI; + XFree( pVI ); + + return true; +} + +#endif + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/generic/app/saldisp.cxx b/vcl/unx/generic/app/saldisp.cxx index 85d3997..159263a 100644 --- a/vcl/unx/generic/app/saldisp.cxx +++ b/vcl/unx/generic/app/saldisp.cxx @@ -67,10 +67,14 @@ #include <unx/sm.hxx> #include <unx/wmadaptor.hxx> +#include <vcl/opengl/OpenGLHelper.hxx> + #include <osl/socket.h> #include <poll.h> #include <boost/scoped_array.hpp> +#include <officecfg/Office/Common.hxx> + using namespace vcl_sal; #define SALCOLOR_WHITE MAKE_SALCOLOR( 0xFF, 0xFF, 0xFF ) @@ -187,6 +191,10 @@ bool SalDisplay::BestVisual( Display *pDisplay, if( nVID && sal_GetVisualInfo( pDisplay, nVID, rVI ) ) return rVI.visualid == nDefVID; + bool bUseOpenGL = officecfg::Office::Common::VCL::UseOpenGL::get(); + if( bUseOpenGL && OpenGLHelper::GetVisualInfo( pDisplay, nScreen, rVI ) ) + return rVI.visualid == nDefVID; + XVisualInfo aVI; aVI.screen = nScreen; // get all visuals commit 1fe2c0500a74addc01994fa0f40820e51754ae90 Author: Louis-Francis Ratté-Boulianne <l...@collabora.com> Date: Tue Nov 4 17:29:49 2014 -0500 vcl: Add method to swap buffers after painting window Change-Id: Icdf691e7e9e83d039e33d2095270290dc31f2efa diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx index 3d5dc3d..5070a5f 100644 --- a/include/vcl/outdev.hxx +++ b/include/vcl/outdev.hxx @@ -518,6 +518,8 @@ public: const Point& rSrcPt, const Size& rSrcSize, sal_uInt16 nFlags = 0 ); + virtual bool SwapBuffers(); + protected: virtual void CopyDeviceArea( SalTwoRect& aPosAry, sal_uInt32 nFlags); diff --git a/vcl/inc/generic/genpspgraphics.h b/vcl/inc/generic/genpspgraphics.h index 30c8fec..fb7169a 100644 --- a/vcl/inc/generic/genpspgraphics.h +++ b/vcl/inc/generic/genpspgraphics.h @@ -192,6 +192,8 @@ public: virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE; virtual SystemFontData GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE; + + virtual bool SwapBuffers() SAL_OVERRIDE { return false; }; }; #endif // INCLUDED_VCL_INC_GENERIC_GENPSPGRAPHICS_H diff --git a/vcl/inc/headless/svpgdi.hxx b/vcl/inc/headless/svpgdi.hxx index cbbac7a..cd5622f 100644 --- a/vcl/inc/headless/svpgdi.hxx +++ b/vcl/inc/headless/svpgdi.hxx @@ -243,6 +243,8 @@ public: virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE; virtual SystemFontData GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE; + virtual bool SwapBuffers() SAL_OVERRIDE { return false; }; + #ifdef IOS void SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContext, int = 0 ); diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx index e8b8947..688a8d9 100644 --- a/vcl/inc/openglgdiimpl.hxx +++ b/vcl/inc/openglgdiimpl.hxx @@ -244,6 +244,8 @@ public: sal_uInt8 nTransparency ) SAL_OVERRIDE; virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) SAL_OVERRIDE; + + virtual bool swapBuffers() SAL_OVERRIDE; private: }; diff --git a/vcl/inc/quartz/salgdi.h b/vcl/inc/quartz/salgdi.h index eb21e09..caab577 100644 --- a/vcl/inc/quartz/salgdi.h +++ b/vcl/inc/quartz/salgdi.h @@ -394,6 +394,8 @@ public: GetGraphicsData() const SAL_OVERRIDE; virtual SystemFontData GetSysFontData( int /* nFallbacklevel */ ) const SAL_OVERRIDE; + virtual bool SwapBuffers() SAL_OVERRIDE { return false; }; + private: // differences between VCL, Quartz and kHiThemeOrientation coordinate systems // make some graphics seem to be vertically-mirrored from a VCL perspective diff --git a/vcl/inc/salgdi.hxx b/vcl/inc/salgdi.hxx index 2266d87..a3917bb 100644 --- a/vcl/inc/salgdi.hxx +++ b/vcl/inc/salgdi.hxx @@ -412,6 +412,8 @@ public: sal_uInt8 nTransparency, const OutputDevice *pOutDev ); + virtual bool SwapBuffers() = 0; + virtual SystemGraphicsData GetGraphicsData() const = 0; virtual SystemFontData GetSysFontData( int nFallbacklevel ) const = 0; diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx index 9802a7b..ba54f9f 100644 --- a/vcl/inc/salgdiimpl.hxx +++ b/vcl/inc/salgdiimpl.hxx @@ -202,6 +202,8 @@ public: sal_uInt8 nTransparency ) = 0; virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) = 0; + + virtual bool swapBuffers() = 0; }; #endif diff --git a/vcl/inc/unx/salgdi.h b/vcl/inc/unx/salgdi.h index 1e90e98..fcb4a9d 100644 --- a/vcl/inc/unx/salgdi.h +++ b/vcl/inc/unx/salgdi.h @@ -296,6 +296,8 @@ public: virtual SystemGraphicsData GetGraphicsData() const SAL_OVERRIDE; virtual SystemFontData GetSysFontData( int nFallbacklevel ) const SAL_OVERRIDE; + virtual bool SwapBuffers() SAL_OVERRIDE; + /* use to handle GraphicsExpose/NoExpose after XCopyArea & friends * if pFrame is not NULL, corresponding Paint events are generated * and dispatched to pFrame diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 09df7ca..3c66dca 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -373,6 +373,8 @@ public: virtual SystemGraphicsData GetGraphicsData() const; virtual SystemFontData GetSysFontData( int nFallbacklevel ) const; + virtual bool SwapBuffers() SAL_OVERRIDE { return false; }; + /// 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 4ee5f95..f6f44de 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -854,4 +854,10 @@ bool OpenGLSalGraphicsImpl::drawGradient(const tools::PolyPolygon& /*rPolygon*/, return false; } +bool OpenGLSalGraphicsImpl::swapBuffers() +{ + maContext.swapBuffers(); + return true; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index cd43b51..2ce3762 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -897,4 +897,11 @@ bool OutputDevice::DrawEPS( const Point& rPoint, const Size& rSize, return bDrawn; } +bool OutputDevice::SwapBuffers() +{ + if( !mpGraphics && !AcquireGraphics() ) + return false; + return mpGraphics->SwapBuffers(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/source/window/paint.cxx b/vcl/source/window/paint.cxx index ce10aba..e5cc31a 100644 --- a/vcl/source/window/paint.cxx +++ b/vcl/source/window/paint.cxx @@ -278,6 +278,8 @@ 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(); } } diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx index e81d16e..b4fb21c 100644 --- a/vcl/unx/generic/gdi/gdiimpl.hxx +++ b/vcl/unx/generic/gdi/gdiimpl.hxx @@ -265,6 +265,8 @@ public: sal_uInt8 nTransparency ) SAL_OVERRIDE; virtual bool drawGradient(const tools::PolyPolygon& rPolygon, const Gradient& rGradient) SAL_OVERRIDE; + + virtual bool swapBuffers() SAL_OVERRIDE { return false; } }; #endif diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index 6edfaba..eee1b3f 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -479,4 +479,9 @@ bool X11SalGraphics::drawGradient(const tools::PolyPolygon& rPoly, const Gradien return mpImpl->drawGradient(rPoly, rGradient); } +bool X11SalGraphics::SwapBuffers() +{ + return mpImpl->swapBuffers(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits