sc/source/ui/app/inputwin.cxx | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-)
New commits: commit 93389ff481297540378238891867df08a0c8e2be Author: Dennis Francis <dennis.fran...@collabora.com> AuthorDate: Thu Dec 9 13:58:07 2021 +0530 Commit: Dennis Francis <dennis.fran...@collabora.com> CommitDate: Mon Dec 13 06:15:13 2021 +0100 lok: paint the inputwin directly to the device... ...using the correct map mode with twips instead of using DrawOutDev() to scale what was drawn in a temporary vdev back to the original device. This fixes the issue: When window width is large (>3.5k pixels) the text in the window is not visible. This was because of the incorrect limiting of the paint area width to the paper-width of the editengine. Change-Id: I46a5c219a6ef07437789fe3de3cbaa245c0e7d72 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/126626 Tested-by: Jenkins Reviewed-by: Dennis Francis <dennis.fran...@collabora.com> diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx index b601fc4d5c34..9029f23e5f95 100644 --- a/sc/source/ui/app/inputwin.cxx +++ b/sc/source/ui/app/inputwin.cxx @@ -1294,22 +1294,14 @@ void ScTextWnd::Paint( vcl::RenderContext& rRenderContext, const tools::Rectangl if (comphelper::LibreOfficeKit::isActive() && m_xEditEngine) { - // in LOK somehow text is rendered very overscaled so render the original content first - // on a virtual device then redraw with correct scale to the target device - - ScopedVclPtrInstance<VirtualDevice> pDevice; - - tools::Long aPaperWidth = m_xEditEngine->GetPaperSize().getWidth(); - double fRatio = static_cast<double>(rRect.GetSize().getHeight()) / rRect.GetSize().getWidth(); - - tools::Rectangle aPaperRect(Point(0, 0), Size(aPaperWidth, aPaperWidth * fRatio)); - aPaperRect = pDevice->PixelToLogic(aPaperRect); - - pDevice->SetOutputSize(aPaperRect.GetSize()); - - WeldEditView::Paint(*pDevice, aPaperRect); - - rRenderContext.DrawOutDev(rRect.TopLeft(), rRect.GetSize(), Point(0,0), aPaperRect.GetSize(), *pDevice); + // EditEngine/EditView works in twips logical coordinates, so set the device map-mode to twips before painting + // and use twips version of the painting area 'rRect'. + // Document zoom should not be included in this conversion. + tools::Rectangle aLogicRect = OutputDevice::LogicToLogic(rRect, MapMode(MapUnit::MapPixel), MapMode(MapUnit::MapTwip)); + MapMode aOriginalMode = rRenderContext.GetMapMode(); + rRenderContext.SetMapMode(MapMode(MapUnit::MapTwip)); + WeldEditView::Paint(rRenderContext, aLogicRect); + rRenderContext.SetMapMode(aOriginalMode); } else WeldEditView::Paint(rRenderContext, rRect);