vcl/source/window/floatwin.cxx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
New commits: commit ea3317188589554ea5773db53aa9e0cc88bee271 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Tue Jul 25 20:59:19 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Wed Jul 26 08:07:58 2023 +0200 simplify logic in FloatingWindow::ImplCalcPos no need to convert this position backwards and forwards Change-Id: Iba4ebcba420025865638c99fa143ea0d7d262805 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154901 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/vcl/source/window/floatwin.cxx b/vcl/source/window/floatwin.cxx index 3aff8ef400c0..aa3abb3ec16b 100644 --- a/vcl/source/window/floatwin.cxx +++ b/vcl/source/window/floatwin.cxx @@ -445,8 +445,6 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow, rArrangeIndex = nArrangeIndex; - aPos = pW->AbsoluteScreenToOutputPixel( aPos ); - // store a cliprect that can be used to clip the common edge of the itemrect and the floating window if( pFloatingWindow && pFloatingWindow->mpImplData->mpBox ) { @@ -456,6 +454,8 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow, if (bLOKActive && pLOKTwipsPos) { + Point aPosOut = pW->AbsoluteScreenToOutputPixel( aPos ); + if (pW->IsMapModeEnabled() || pW->GetMapMode().GetMapUnit() == MapUnit::MapPixel) { // if we use pW->LogicToLogic(aPos, pW->GetMapMode(), MapMode(MapUnit::MapTwip)), @@ -466,16 +466,16 @@ Point FloatingWindow::ImplCalcPos(vcl::Window* pWindow, // and anyway the following is what we already do in // ScGridWindow::LogicInvalidate when map mode is not enabled. - *pLOKTwipsPos = pW->PixelToLogic(aPos, MapMode(MapUnit::MapTwip)); + *pLOKTwipsPos = pW->PixelToLogic(aPosOut, MapMode(MapUnit::MapTwip)); } else { - *pLOKTwipsPos = OutputDevice::LogicToLogic(aPos, pW->GetMapMode(), MapMode(MapUnit::MapTwip)); + *pLOKTwipsPos = OutputDevice::LogicToLogic(aPosOut, pW->GetMapMode(), MapMode(MapUnit::MapTwip)); } } // caller expects coordinates relative to top-level win - return pW->OutputToScreenPixel( aPos ); + return aPos; } Point FloatingWindow::ImplConvertToAbsPos(vcl::Window* pReference, const Point& rPos)