diff options
author | Louis-Francis Ratté-Boulianne <lfrb@collabora.com> | 2014-11-22 07:58:38 -0500 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-12-02 15:47:21 +0100 |
commit | 8b0954e2619ccd82a8ccb1426734bcab2068f89c (patch) | |
tree | a2386f01c82a249eb61342eee10fc19ca7a9ef96 /vcl/inc | |
parent | 260a0b53b758daa79aa6a87d07537841821d25ff (diff) |
vcl: Always use the same OpenGL context when drawing in a window
Change-Id: Ief0e947149c133aaa8e81973e088c4df6432bfdc
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/opengl/win/gdiimpl.hxx | 9 | ||||
-rw-r--r-- | vcl/inc/opengl/x11/gdiimpl.hxx | 6 | ||||
-rw-r--r-- | vcl/inc/openglgdiimpl.hxx | 22 | ||||
-rw-r--r-- | vcl/inc/salgdiimpl.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/svdata.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/unx/x11/x11gdiimpl.h | 1 | ||||
-rw-r--r-- | vcl/inc/win/salgdi.h | 1 |
7 files changed, 38 insertions, 6 deletions
diff --git a/vcl/inc/opengl/win/gdiimpl.hxx b/vcl/inc/opengl/win/gdiimpl.hxx index 557e58a09af3..66a03332284c 100644 --- a/vcl/inc/opengl/win/gdiimpl.hxx +++ b/vcl/inc/opengl/win/gdiimpl.hxx @@ -15,6 +15,8 @@ #include "openglgdiimpl.hxx" #include "win/salgdi.h" +class OpenGLContext; + class WinOpenGLSalGraphicsImpl : public OpenGLSalGraphicsImpl { friend class WinLayout; @@ -24,9 +26,16 @@ private: public: WinOpenGLSalGraphicsImpl(WinSalGraphics& rGraphics); + virtual void Init() SAL_OVERRIDE; + protected: virtual GLfloat GetWidth() const SAL_OVERRIDE; virtual GLfloat GetHeight() const SAL_OVERRIDE; + virtual bool IsOffscreen() const SAL_OVERRIDE; + + virtual OpenGLContext* CreateWinContext() SAL_OVERRIDE; + virtual bool CompareWinContext( OpenGLContext* pContext ) SAL_OVERRIDE; + virtual OpenGLContext* CreatePixmapContext() SAL_OVERRIDE; public: virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) SAL_OVERRIDE; diff --git a/vcl/inc/opengl/x11/gdiimpl.hxx b/vcl/inc/opengl/x11/gdiimpl.hxx index d25d5d0212ca..f5e5bfb4f2f4 100644 --- a/vcl/inc/opengl/x11/gdiimpl.hxx +++ b/vcl/inc/opengl/x11/gdiimpl.hxx @@ -28,12 +28,16 @@ public: protected: GLfloat GetWidth() const SAL_OVERRIDE; GLfloat GetHeight() const SAL_OVERRIDE; + bool IsOffscreen() const SAL_OVERRIDE; + + virtual OpenGLContext* CreateWinContext() SAL_OVERRIDE; + virtual bool CompareWinContext( OpenGLContext* pContext ) SAL_OVERRIDE; + virtual OpenGLContext* CreatePixmapContext() SAL_OVERRIDE; public: // implementation of X11GraphicsImpl virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) SAL_OVERRIDE; - void Init() SAL_OVERRIDE; bool FillPixmapFromScreen( X11Pixmap* pPixmap, int nX, int nY ) SAL_OVERRIDE; bool RenderPixmapToScreen( X11Pixmap* pPixmap, X11Pixmap* pMask, int nX, int nY ) SAL_OVERRIDE; }; diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx index 2031c91c982f..e84aa7bf934e 100644 --- a/vcl/inc/openglgdiimpl.hxx +++ b/vcl/inc/openglgdiimpl.hxx @@ -35,9 +35,9 @@ class VCL_PLUGIN_PUBLIC OpenGLSalGraphicsImpl : public SalGraphicsImpl { protected: - OpenGLContext maContext; SalFrame* mpFrame; int mnPainting; + OpenGLContext* mpContext; // clipping bool mbUseScissor; @@ -144,21 +144,35 @@ public: // get the height of the device virtual GLfloat GetHeight() const = 0; + // check whether this instance is used for offscreen rendering + virtual bool IsOffscreen() const = 0; + // operations to do before painting virtual void PreDraw(); // operations to do after painting virtual void PostDraw(); - // enable/disable offscreen rendering - virtual void SetOffscreen( bool bOffscreen ); +protected: + bool AcquireContext( bool bOffscreen ); + bool ReleaseContext(); + + // create a new context for window rendering + virtual OpenGLContext* CreateWinContext() = 0; + // check whether the given context can be used by this instance + virtual bool CompareWinContext( OpenGLContext* pContext ) = 0; + + // create a new context for window rendering + virtual OpenGLContext* CreatePixmapContext() = 0; public: OpenGLSalGraphicsImpl(); virtual ~OpenGLSalGraphicsImpl (); - OpenGLContext& GetOpenGLContext() { return maContext; } + OpenGLContext& GetOpenGLContext() { return *mpContext; } + + virtual void Init() SAL_OVERRIDE; virtual void freeResources() SAL_OVERRIDE; diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx index 2fd7f56df28e..e92c65f29738 100644 --- a/vcl/inc/salgdiimpl.hxx +++ b/vcl/inc/salgdiimpl.hxx @@ -44,6 +44,8 @@ public: virtual ~SalGraphicsImpl(); + virtual void Init() = 0; + virtual void freeResources() = 0; virtual bool setClipRegion( const vcl::Region& ) = 0; diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index c1d9eed2c45d..212e036ea13f 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -89,6 +89,7 @@ class SalI18NImeStatus; class DockingManager; class VclEventListeners2; class SalData; +class OpenGLContext; namespace vcl { class DisplayConnection; class SettingsConfigItem; class DeleteOnDeinitBase; } @@ -161,6 +162,8 @@ struct ImplSVGDIData OutputDevice* mpLastPrnGraphics; // Last OutputDevice with a InfoPrinter Graphics VirtualDevice* mpFirstVirDev; // First VirtualDevice VirtualDevice* mpLastVirDev; // Last VirtualDevice + OpenGLContext* mpFirstContext; // First OpenGLContext + OpenGLContext* mpLastContext; // Last OpenGLContext Printer* mpFirstPrinter; // First Printer Printer* mpLastPrinter; // Last Printer ImplPrnQueueList* mpPrinterQueueList; // List of all printer queue diff --git a/vcl/inc/unx/x11/x11gdiimpl.h b/vcl/inc/unx/x11/x11gdiimpl.h index 239d2174b45c..22859c315b6d 100644 --- a/vcl/inc/unx/x11/x11gdiimpl.h +++ b/vcl/inc/unx/x11/x11gdiimpl.h @@ -17,7 +17,6 @@ class X11GraphicsImpl public: virtual ~X11GraphicsImpl() {}; - virtual void Init() = 0; virtual bool FillPixmapFromScreen( X11Pixmap* pPixmap, int nX, int nY ) = 0; virtual bool RenderPixmapToScreen( X11Pixmap* pPixmap, X11Pixmap* pMask, int nX, int nY ) = 0; }; diff --git a/vcl/inc/win/salgdi.h b/vcl/inc/win/salgdi.h index 1af78077584c..443c1c2377af 100644 --- a/vcl/inc/win/salgdi.h +++ b/vcl/inc/win/salgdi.h @@ -181,6 +181,7 @@ public: class WinSalGraphics : public SalGraphics { friend class WinSalGraphicsImpl; + friend class WinOpenGLSalGraphicsImpl; friend class ScopedFont; friend class OpenGLCompatibleDC; friend class WinLayout; |