include/basegfx/numeric/ftools.hxx | 12 ++++++++---- vcl/source/opengl/win/context.cxx | 9 +++++++++ 2 files changed, 17 insertions(+), 4 deletions(-)
New commits: commit 48a822fe60fa6cdb8d105604f4511bd7f7d69903 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Sep 7 11:49:13 2022 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Sep 7 14:01:40 2022 +0200 Use exactly two comparisons in fround It is used extensively in drawinglayer; the typical path for values inside sal_Int32 range used three comparisons. Change-Id: Iafb09f06a746bb53a41585be4a5b1a701fa38057 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139555 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/include/basegfx/numeric/ftools.hxx b/include/basegfx/numeric/ftools.hxx index 14deaa059020..4f1bc1680000 100644 --- a/include/basegfx/numeric/ftools.hxx +++ b/include/basegfx/numeric/ftools.hxx @@ -37,11 +37,15 @@ namespace basegfx */ inline sal_Int32 fround( double fVal ) { - if (fVal >= std::numeric_limits<sal_Int32>::max() - .5) - return std::numeric_limits<sal_Int32>::max(); - else if (fVal <= std::numeric_limits<sal_Int32>::min() + .5) + if (fVal >= 0.0) + { + if (fVal >= std::numeric_limits<sal_Int32>::max() - .5) + return std::numeric_limits<sal_Int32>::max(); + return static_cast<sal_Int32>(fVal + .5); + } + if (fVal <= std::numeric_limits<sal_Int32>::min() + .5) return std::numeric_limits<sal_Int32>::min(); - return fVal > 0.0 ? static_cast<sal_Int32>( fVal + .5 ) : static_cast<sal_Int32>( fVal - .5 ); + return static_cast<sal_Int32>(fVal - .5); } /** Round double to nearest integer commit ca6888484e643e0c55918d9c882241e6dd6b734f Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Sep 7 13:11:44 2022 +0300 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Sep 7 14:01:23 2022 +0200 Related: tdf#122737 A hack to keep backing window opaque on context destruction Also this incidentally improves OpenGL frame rate, which could decrease the problem visibility (but indeed, this is not a proper fix). Change-Id: If1d0eec78cad14548a51be7da76f16a3ecfcddb9 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/139581 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> diff --git a/vcl/source/opengl/win/context.cxx b/vcl/source/opengl/win/context.cxx index 3111048a2e23..cadd213a1ce3 100644 --- a/vcl/source/opengl/win/context.cxx +++ b/vcl/source/opengl/win/context.cxx @@ -146,6 +146,15 @@ void WinOpenGLContext::initWindow() InitChildWindow(m_pChildWindow.get()); const SystemEnvData* sysData(m_pChildWindow->GetSystemData()); + + // Hack: the performance of OpenGL increases with non-child window. + // Also, this keeps the backing window opaque on GL context destruction, + // which doesn't prevent the flicker (tdf#122737) completely, but at + // least doesn't show user desktop during the flicker. + LONG_PTR style = GetWindowLongPtrW(sysData->hWnd, GWL_STYLE); + style &= ~WS_CHILD; + SetWindowLongPtrW(sysData->hWnd, GWL_STYLE, style); + m_aGLWin.hWnd = sysData->hWnd; m_aGLWin.hDC = GetDC(m_aGLWin.hWnd);