summaryrefslogtreecommitdiff
path: root/sc/source/ui/app/inputwin.cxx
diff options
context:
space:
mode:
authorDennis Francis <dennis.francis@collabora.com>2021-12-09 13:58:07 +0530
committerDennis Francis <dennis.francis@collabora.com>2021-12-13 06:15:13 +0100
commit93389ff481297540378238891867df08a0c8e2be (patch)
tree53d41db83c151efbfcbd04b9b8b5d44c29405723 /sc/source/ui/app/inputwin.cxx
parent5242061cca5332ec15cce8c76f070d16e857445d (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/+/126626 Tested-by: Jenkins Reviewed-by: Dennis Francis <dennis.francis@collabora.com>
Diffstat (limited to 'sc/source/ui/app/inputwin.cxx')
-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 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);