summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--vcl/inc/openglgdiimpl.hxx5
-rw-r--r--vcl/inc/salgdiimpl.hxx3
-rw-r--r--vcl/opengl/gdiimpl.cxx16
-rw-r--r--vcl/source/opengl/OpenGLContext.cxx9
-rw-r--r--vcl/unx/generic/gdi/gdiimpl.cxx6
-rw-r--r--vcl/unx/generic/gdi/gdiimpl.hxx2
-rw-r--r--vcl/unx/generic/gdi/salgdi.cxx21
7 files changed, 43 insertions, 19 deletions
diff --git a/vcl/inc/openglgdiimpl.hxx b/vcl/inc/openglgdiimpl.hxx
index cad2c4d3826c..6643546d081f 100644
--- a/vcl/inc/openglgdiimpl.hxx
+++ b/vcl/inc/openglgdiimpl.hxx
@@ -25,11 +25,14 @@
#include <vcl/opengl/OpenGLContext.hxx>
+class SalFrame;
+
class VCL_PLUGIN_PUBLIC OpenGLSalGraphicsImpl : public SalGraphicsImpl
{
private:
OpenGLContext maContext;
+ SalFrame* mpFrame;
SalColor mnLineColor;
SalColor mnFillColor;
@@ -84,6 +87,8 @@ public:
virtual void freeResources() SAL_OVERRIDE;
+ virtual void Init( SalFrame* pFrame ) SAL_OVERRIDE;
+
virtual bool setClipRegion( const vcl::Region& ) SAL_OVERRIDE;
//
// get the depth of the device
diff --git a/vcl/inc/salgdiimpl.hxx b/vcl/inc/salgdiimpl.hxx
index ed4f4ba0caf6..9802a7b6c681 100644
--- a/vcl/inc/salgdiimpl.hxx
+++ b/vcl/inc/salgdiimpl.hxx
@@ -34,6 +34,7 @@
class SalGraphics;
class SalBitmap;
+class SalFrame;
class Gradient;
class VCL_PLUGIN_PUBLIC SalGraphicsImpl
@@ -42,6 +43,8 @@ public:
virtual ~SalGraphicsImpl();
+ virtual void Init( SalFrame* pFrame ) = 0;
+
virtual void freeResources() = 0;
virtual bool setClipRegion( const vcl::Region& ) = 0;
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx
index 528b1d5ebfdc..65cff6a1c08d 100644
--- a/vcl/opengl/gdiimpl.cxx
+++ b/vcl/opengl/gdiimpl.cxx
@@ -20,6 +20,7 @@
#include "openglgdiimpl.hxx"
#include <vcl/gradient.hxx>
+#include <salframe.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolygontriangulator.hxx>
@@ -45,6 +46,11 @@ void OpenGLSalGraphicsImpl::freeResources()
// Delete shaders, programs and textures if not shared
}
+void OpenGLSalGraphicsImpl::Init( SalFrame* pFrame )
+{
+ mpFrame = pFrame;
+}
+
bool OpenGLSalGraphicsImpl::setClipRegion( const vcl::Region& rClip )
{
const basegfx::B2DPolyPolygon aClip( rClip.GetAsB2DPolyPolygon() );
@@ -77,17 +83,21 @@ sal_uInt16 OpenGLSalGraphicsImpl::GetBitCount() const
// get the width of the device
long OpenGLSalGraphicsImpl::GetGraphicsWidth() const
{
- return maContext.getOpenGLWindow().Width;
+ return GetWidth();
}
inline GLfloat OpenGLSalGraphicsImpl::GetWidth() const
{
- return maContext.getOpenGLWindow().Width;
+ if( mpFrame )
+ return mpFrame->maGeometry.nWidth;
+ return 0;
}
inline GLfloat OpenGLSalGraphicsImpl::GetHeight() const
{
- return maContext.getOpenGLWindow().Height;
+ if( mpFrame )
+ return mpFrame->maGeometry.nHeight;
+ return 0;
}
// set the clip region to empty
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index 508bf0ba4f14..f1686e3f10a1 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -540,10 +540,10 @@ bool OpenGLContext::init(HDC hDC, HWND hWnd)
bool OpenGLContext::ImplInit()
{
SAL_INFO("vcl.opengl", "OpenGLContext::ImplInit----start");
- if(m_pWindow)
+ /*if(m_pWindow)
m_pWindow->setPosSizePixel(0,0,0,0);
m_aGLWin.Width = 0;
- m_aGLWin.Height = 0;
+ m_aGLWin.Height = 0;*/
#if defined( WNT )
#elif defined( MACOSX )
@@ -683,6 +683,11 @@ bool OpenGLContext::ImplInit()
m_aGLWin.GLExtensions = glGetString( GL_EXTENSIONS );
SAL_INFO("vcl.opengl", "available GL extensions: " << m_aGLWin.GLExtensions);
+ XWindowAttributes xWinAttr;
+ XGetWindowAttributes( m_aGLWin.dpy, m_aGLWin.win, &xWinAttr );
+ m_aGLWin.Width = xWinAttr.width;
+ m_aGLWin.Height = xWinAttr.height;
+
if( m_aGLWin.HasGLXExtension("GLX_SGI_swap_control" ) )
{
// enable vsync
diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx
index 60ed793915f6..6b90220a0ac8 100644
--- a/vcl/unx/generic/gdi/gdiimpl.cxx
+++ b/vcl/unx/generic/gdi/gdiimpl.cxx
@@ -153,6 +153,12 @@ X11SalGraphicsImpl::~X11SalGraphicsImpl()
{
}
+void X11SalGraphicsImpl::Init( SalFrame* /*pFrame*/ )
+{
+ mnPenPixel = mrParent.GetPixel( mnPenColor );
+ mnBrushPixel = mrParent.GetPixel( mnBrushColor );
+}
+
XID X11SalGraphicsImpl::GetXRenderPicture()
{
XRenderPeer& rRenderPeer = XRenderPeer::GetInstance();
diff --git a/vcl/unx/generic/gdi/gdiimpl.hxx b/vcl/unx/generic/gdi/gdiimpl.hxx
index a6e12ecb6d14..e81d16ee0cb5 100644
--- a/vcl/unx/generic/gdi/gdiimpl.hxx
+++ b/vcl/unx/generic/gdi/gdiimpl.hxx
@@ -108,6 +108,8 @@ public:
virtual ~X11SalGraphicsImpl();
+ virtual void Init( SalFrame* pFrame ) SAL_OVERRIDE;
+
virtual bool setClipRegion( const vcl::Region& ) SAL_OVERRIDE;
//
// get the depth of the device
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx
index c5dd0bedd54a..97e060eb0a91 100644
--- a/vcl/unx/generic/gdi/salgdi.cxx
+++ b/vcl/unx/generic/gdi/salgdi.cxx
@@ -148,22 +148,15 @@ void X11SalGraphics::SetDrawable( Drawable aDrawable, SalX11Screen nXScreen )
if( hDrawable_ )
{
- X11SalGraphicsImpl* pImpl = dynamic_cast<X11SalGraphicsImpl*>(mpImpl.get());
- if (pImpl)
+ OpenGLSalGraphicsImpl* pOpenGLImpl = dynamic_cast<OpenGLSalGraphicsImpl*>(mpImpl.get());
+ if (pOpenGLImpl && m_pFrame && dynamic_cast<X11WindowProvider*>(m_pFrame))
{
- pImpl->mnPenPixel = GetPixel( pImpl->mnPenColor );
- pImpl->mnBrushPixel = GetPixel( pImpl->mnBrushColor );
- }
- else
- {
- OpenGLSalGraphicsImpl* pOpenGLImpl = dynamic_cast<OpenGLSalGraphicsImpl*>(mpImpl.get());
- if (pOpenGLImpl && m_pFrame && dynamic_cast<X11WindowProvider*>(m_pFrame))
- {
- Window aWin = dynamic_cast<X11WindowProvider*>(m_pFrame)->GetX11Window();
- pOpenGLImpl->GetOpenGLContext().init(GetXDisplay(),
- aWin, m_nXScreen.getXScreen());
- }
+ Window aWin = dynamic_cast<X11WindowProvider*>(m_pFrame)->GetX11Window();
+ pOpenGLImpl->GetOpenGLContext().init(GetXDisplay(),
+ aWin, m_nXScreen.getXScreen());
}
+
+ mpImpl->Init( m_pFrame );
nTextPixel_ = GetPixel( nTextColor_ );
}
}