Kaydet (Commit) 9557ae7b authored tarafından Michael Meeks's avatar Michael Meeks

vcl: update the OpenGLContext's pixmap when re-sizing a VirtualDevice.

Change-Id: Iee8089fc3bfbea60adee95dfb2c229f3efea28f8
üst f12e8ff5
......@@ -195,6 +195,8 @@ public:
return mbInitialized;
}
void resetToReInitialize();
bool supportMultiSampling() const;
static SystemWindowData generateWinData(vcl::Window* pParent, bool bRequestLegacyContext);
......
......@@ -62,6 +62,9 @@ GLfloat X11OpenGLSalGraphicsImpl::GetHeight() const
void X11OpenGLSalGraphicsImpl::Init()
{
X11WindowProvider *pProvider = dynamic_cast<X11WindowProvider*>(mrParent.m_pFrame);
// Called after eg. a vdev re-size where we need to update the underlying pixmap
maContext.resetToReInitialize();
if (pProvider)
{
Window aWin = pProvider->GetX11Window();
......
......@@ -610,6 +610,14 @@ bool OpenGLContext::init(Display* dpy, Window win, int screen)
return ImplInit();
}
void OpenGLContext::resetToReInitialize()
{
if( !mbInitialized )
return;
resetCurrent();
mbInitialized = false;
}
bool OpenGLContext::init(Display* dpy, Pixmap pix, unsigned int width, unsigned int height, int nScreen)
{
if(mbInitialized)
......@@ -712,7 +720,12 @@ bool OpenGLContext::ImplInit()
SAL_INFO("vcl.opengl", "available GL extensions: " << m_aGLWin.GLExtensions);
XWindowAttributes xWinAttr;
if( !XGetWindowAttributes( m_aGLWin.dpy, m_aGLWin.win, &xWinAttr ) )
if( mbPixmap )
{
m_aGLWin.Width = 0; // FIXME: correct ?
m_aGLWin.Height = 0;
}
else if( !XGetWindowAttributes( m_aGLWin.dpy, m_aGLWin.win, &xWinAttr ) )
{
SAL_WARN("vcl.opengl", "Failed to get window attributes on " << m_aGLWin.win);
m_aGLWin.Width = 0;
......@@ -1159,7 +1172,7 @@ void OpenGLContext::makeCurrent()
SAL_INFO("vcl.opengl", "OpenGLContext::makeCurrent(): Avoid setting the same context");
}
else if (!glXMakeCurrent( m_aGLWin.dpy, nDrawable, m_aGLWin.ctx ))
SAL_WARN("vcl.opengl", "OpenGLContext::makeCurrent failed");
SAL_WARN("vcl.opengl", "OpenGLContext::makeCurrent failed on drawable " << nDrawable << " pixmap? " << mbPixmap);
#endif
}
......
......@@ -196,6 +196,8 @@ SalGraphics* X11SalVirtualDevice::AcquireGraphics()
void X11SalVirtualDevice::ReleaseGraphics( SalGraphics* )
{ bGraphics_ = false; }
#include "opengl/x11/gdiimpl.hxx"
bool X11SalVirtualDevice::SetSize( long nDX, long nDY )
{
if( bExternPixmap_ )
......@@ -229,8 +231,15 @@ bool X11SalVirtualDevice::SetSize( long nDX, long nDY )
nDY_ = nDY;
if( pGraphics_ )
{
InitGraphics( this );
// re-initialize OpenGLContext [!] having freed it's underlying pixmap above
X11OpenGLSalGraphicsImpl *pImpl = dynamic_cast< X11OpenGLSalGraphicsImpl* >(pGraphics_->GetImpl());
if( pImpl )
pImpl->Init();
}
return true;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment