[Libreoffice-commits] core.git: include/vcl slideshow/source vcl/source vcl/unx
Caolán McNamara
caolanm at redhat.com
Mon Sep 11 07:50:43 UTC 2017
include/vcl/opengl/OpenGLContext.hxx | 1 +
slideshow/source/engine/opengl/TransitionerImpl.cxx | 1 -
vcl/source/opengl/OpenGLContext.cxx | 11 +++++++++--
vcl/unx/gtk3/gtk3gtkinst.cxx | 13 +++++++++++++
4 files changed, 23 insertions(+), 3 deletions(-)
New commits:
commit 1a547a566eba5943f9e4d9987baf4aee80846dd1
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Sep 10 16:07:49 2017 +0100
hidpi+gtk3: move setting the opengl slide viewport
to when the window size is set, and adjust to gtk3 hidpi
scaling factor
Change-Id: Id9bd0defd0b6ae640ac57f88133d954202d4bcc3
Reviewed-on: https://gerrit.libreoffice.org/42143
Tested-by: Jenkins <ci at libreoffice.org>
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Tested-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 738f503269d2..b638d70ccc36 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -158,6 +158,7 @@ public:
private:
virtual bool initWindow();
virtual void destroyCurrentContext();
+ virtual void adjustToNewSize();
protected:
bool InitGL();
diff --git a/slideshow/source/engine/opengl/TransitionerImpl.cxx b/slideshow/source/engine/opengl/TransitionerImpl.cxx
index 95d97533325e..846b5ca8c0c0 100644
--- a/slideshow/source/engine/opengl/TransitionerImpl.cxx
+++ b/slideshow/source/engine/opengl/TransitionerImpl.cxx
@@ -344,7 +344,6 @@ bool OGLTransitionerImpl::initWindowFromSlideShowView( const Reference< presenta
mpContext->swapBuffers();
- glViewport(0, 0, aCanvasArea.Width, aCanvasArea.Height);
CHECK_GL_ERROR();
return true;
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index d2a5fc8a963b..d5ade0408fc5 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -333,14 +333,21 @@ void OpenGLContext::restoreDefaultFramebuffer()
void OpenGLContext::setWinPosAndSize(const Point &rPos, const Size& rSize)
{
- if(m_xWindow)
+ if (m_xWindow)
m_xWindow->SetPosSizePixel(rPos, rSize);
- if( m_pChildWindow )
+ if (m_pChildWindow)
m_pChildWindow->SetPosSizePixel(rPos, rSize);
GLWindow& rGLWin = getModifiableOpenGLWindow();
rGLWin.Width = rSize.Width();
rGLWin.Height = rSize.Height();
+ adjustToNewSize();
+}
+
+void OpenGLContext::adjustToNewSize()
+{
+ const GLWindow& rGLWin = getOpenGLWindow();
+ glViewport(0, 0, rGLWin.Width, rGLWin.Height);
}
void OpenGLContext::setWinSize(const Size& rSize)
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index 2e76077521fc..72b71c9d7519 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -978,6 +978,19 @@ private:
}
#endif
+ virtual void adjustToNewSize() override
+ {
+#if GTK_CHECK_VERSION(3,16,0)
+ if (m_pGLArea)
+ {
+ int scale = gtk_widget_get_scale_factor(m_pGLArea);
+ int width = m_aGLWin.Width * scale;
+ int height = m_aGLWin.Height * scale;
+ glViewport(0, 0, width, height);
+ }
+#endif
+ }
+
virtual void makeCurrent() override
{
if (isCurrent())
More information about the Libreoffice-commits
mailing list