summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2021-12-09 13:58:07 +0530
committerDennis Francis <dennis.francis@collabora.com>2022-01-05 05:42:13 +0100
commit7cb0a56499c80fb2db15220bcab51eb6cc6f707b (patch)
treea11a208d1665f762367b5061284e7d2f49c03796
parentf64fd5abf2a9cd7dd2cba9a57a4c8013cd634472 (diff)
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/+/126570 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
-rw-r--r--sc/source/ui/app/inputwin.cxx24
1 files changed, 8 insertions, 16 deletions
diff --git a/sc/source/ui/app/inputwin.cxx b/sc/source/ui/app/inputwin.cxx
index e161496f6fe5..3072395788e9 100644
--- a/sc/source/ui/app/inputwin.cxx
+++ b/sc/source/ui/app/inputwin.cxx
@@ -1293,22 +1293,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);