[Libreoffice-commits] core.git: Branch 'feature/opengl-vcl' - 4 commits - include/vcl vcl/source vcl/win
Markus Mohrhard
markus.mohrhard at googlemail.com
Sat Nov 1 20:15:18 PDT 2014
include/vcl/opengl/OpenGLContext.hxx | 2 ++
vcl/source/opengl/OpenGLContext.cxx | 12 +++++++++++-
vcl/win/source/gdi/salgdi.cxx | 23 +++++++++++++++++------
3 files changed, 30 insertions(+), 7 deletions(-)
New commits:
commit 58fc3a6992332b8a6dba2fe7a077f421f27725c5
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Nov 2 04:13:34 2014 +0100
forgot to remove the env variable based OpenGL setting
Change-Id: Ib4d0c4730eceac483bb179ce4e75fe555bba91fa
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index 97f102e..9dfcf74 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -602,12 +602,6 @@ WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hW
mpWinFontEntry[ i ] = NULL;
mfFontScale[ i ] = 1.0;
}
-
- static const char* pEnv = getenv("USE_OPENGL");
- if (pEnv)
- {
- mpImpl.reset(new OpenGLSalGraphicsImpl());
- }
}
WinSalGraphics::~WinSalGraphics()
commit 446d01bc8725d1a63d5234887d0468cdae49a496
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Nov 2 04:12:59 2014 +0100
init the OpenGL context in the windows backend
Change-Id: Ic4fb491c95170639015a4452f355354ad01612bc
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx
index 1692ba0..3a8ec9a 100644
--- a/include/vcl/opengl/OpenGLContext.hxx
+++ b/include/vcl/opengl/OpenGLContext.hxx
@@ -164,6 +164,8 @@ public:
// only in vcl's platform code
#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID
bool init(Display* dpy, Window win, int screen);
+#elif defined( _WIN32 )
+ bool init( HDC hDC, HWND hWnd );
#endif
void makeCurrent();
diff --git a/vcl/source/opengl/OpenGLContext.cxx b/vcl/source/opengl/OpenGLContext.cxx
index b4c2cee..fe97372 100644
--- a/vcl/source/opengl/OpenGLContext.cxx
+++ b/vcl/source/opengl/OpenGLContext.cxx
@@ -513,6 +513,16 @@ bool OpenGLContext::init(Display* dpy, Window win, int screen)
return ImplInit();
}
+#elif defined( _WIN32 )
+bool OpenGLContext::init(HDC hDC, HWND hWnd)
+{
+ if (mbInitialized)
+ return false;
+
+ m_aGLWin.hDC = hDC;
+ m_aGLWin.hWnd = hWnd;
+ return ImplInit();
+}
#endif
bool OpenGLContext::ImplInit()
@@ -524,7 +534,6 @@ bool OpenGLContext::ImplInit()
m_aGLWin.Height = 0;
#if defined( WNT )
- m_aGLWin.hDC = GetDC(m_aGLWin.hWnd);
#elif defined( MACOSX )
#elif defined( IOS )
@@ -778,6 +787,7 @@ bool OpenGLContext::initWindow()
m_aGLWin.hWnd = sysData->hWnd;
}
+ m_aGLWin.hDC = GetDC(m_aGLWin.hWnd);
return true;
}
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index e3a6fad..97f102e 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -483,6 +483,12 @@ void WinSalGraphics::InitGraphics()
::SetTextAlign( getHDC(), TA_BASELINE | TA_LEFT | TA_NOUPDATECP );
::SetBkMode( getHDC(), WIN32_TRANSPARENT );
::SetROP2( getHDC(), R2_COPYPEN );
+
+ OpenGLSalGraphicsImpl* pImpl = dynamic_cast<OpenGLSalGraphicsImpl*>(mpImpl.get());
+ if (pImpl)
+ {
+ pImpl->GetOpenGLContext().init(mhLocalDC, mhWnd);
+ }
}
void WinSalGraphics::DeInitGraphics()
commit 789208bcd165f4d53447a602833a0bdfd7733e41
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Nov 2 03:54:44 2014 +0100
don't try to use OpenGL for printing
Change-Id: I88403bcb5b1974deba237c497885d3793a29315c
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index b1a164e1..e3a6fad 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -583,7 +583,7 @@ WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hW
mnPenWidth(GSL_PEN_WIDTH)
{
static bool bOpenGLPossible = OpenGLHelper::supportsVCLOpenGL();
- bool bUseOpenGL = bOpenGLPossible ? officecfg::Office::Common::VCL::UseOpenGL::get() : false;
+ bool bUseOpenGL = bOpenGLPossible && !mbPrinter ? officecfg::Office::Common::VCL::UseOpenGL::get() : false;
if (bUseOpenGL)
mpImpl.reset(new OpenGLSalGraphicsImpl());
else
commit d6a1c284cf14b4163204a243f2c52e40d8522a6a
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date: Sun Nov 2 03:50:57 2014 +0100
improve OpenGL rendering engine selection for Windows backend
Change-Id: Ibcf520aac1441e5ce86b83372061550f8957ab17
diff --git a/vcl/win/source/gdi/salgdi.cxx b/vcl/win/source/gdi/salgdi.cxx
index 4022d2d..b1a164e1 100644
--- a/vcl/win/source/gdi/salgdi.cxx
+++ b/vcl/win/source/gdi/salgdi.cxx
@@ -36,6 +36,10 @@
#include "gdiimpl.hxx"
#include "openglgdiimpl.hxx"
+#include <vcl/opengl/OpenGLHelper.hxx>
+
+#include <officecfg/Office/Common.hxx>
+
#define DITHER_PAL_DELTA 51
#define DITHER_PAL_STEPS 6
#define DITHER_PAL_COUNT (DITHER_PAL_STEPS*DITHER_PAL_STEPS*DITHER_PAL_STEPS)
@@ -578,6 +582,13 @@ WinSalGraphics::WinSalGraphics(WinSalGraphics::Type eType, bool bScreen, HWND hW
mbFontKernInit(false),
mnPenWidth(GSL_PEN_WIDTH)
{
+ static bool bOpenGLPossible = OpenGLHelper::supportsVCLOpenGL();
+ bool bUseOpenGL = bOpenGLPossible ? officecfg::Office::Common::VCL::UseOpenGL::get() : false;
+ if (bUseOpenGL)
+ mpImpl.reset(new OpenGLSalGraphicsImpl());
+ else
+ mpImpl.reset(new WinSalGraphicsImpl(*this));
+
for( int i = 0; i < MAX_FALLBACK; ++i )
{
mhFonts[ i ] = 0;
More information about the Libreoffice-commits
mailing list