editeng/source/editeng/impedit.cxx |   18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

New commits:
commit 7c483a0d5287de5eb0face12d02673a50f656633
Author:     Armin Le Grand (allotropia) <armin.le.grand.ext...@allotropia.de>
AuthorDate: Mon Feb 24 15:33:16 2025 +0100
Commit:     Thorsten Behrens <thorsten.behr...@allotropia.de>
CommitDate: Sun Mar 2 19:32:14 2025 +0100

    Avoid slight jumping of TextEdit on activation
    
    A PixelSnap was used before using GetOutputDevice() and
    LogicToPixel/PixelToLogic (what was incorrect, would need
    to take care of 1/2 pixel in logic for rounding). We do not
    need that anymore, in fact it leads to the text slightly
    'jumping' around by up to 1 pixel (of course).
    
    We paint text nowadays using decomposed TextPrimitives
    with sub-pixel precision and similar (using a shortcut)
    for text in TextEdit on the Overlay, also using sub-pixel
    precision. Just remove this to avoid Text being displayed
    different in TextEdit and EditView paint visualizations
    and assign given value to OutputArea unchanged.
    
    If this should cause problems somewhere (I do not think so,
    we try to paint text with Sub-Pixel quality now anyways)
    this can also be done in alternative ways and only for
    TextEdit on Overlay.
    
    Change-Id: If177ceec880a29a6d102ad4f0dddf891d95b69c2
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/182094
    Tested-by: Jenkins
    Reviewed-by: Thorsten Behrens <thorsten.behr...@allotropia.de>

diff --git a/editeng/source/editeng/impedit.cxx 
b/editeng/source/editeng/impedit.cxx
index f67073380470..337183d04ac3 100644
--- a/editeng/source/editeng/impedit.cxx
+++ b/editeng/source/editeng/impedit.cxx
@@ -858,11 +858,19 @@ weld::Widget* 
ImpEditView::GetPopupParent(tools::Rectangle& rRect) const
 
 void ImpEditView::SetOutputArea( const tools::Rectangle& rRect )
 {
-    const OutputDevice& rOutDev = GetOutputDevice();
-    // should be better be aligned on pixels!
-    tools::Rectangle aNewRect(rOutDev.LogicToPixel(rRect));
-    aNewRect = rOutDev.PixelToLogic(aNewRect);
-    maOutputArea = aNewRect;
+    // Here a PixelSnap was used before using GetOutputDevice() and
+    // LogicToPixel/PixelToLogic (what was incorrect, would need
+    // to take care of 1/2 pixel in logic for rounding). We do not
+    // need that anymore, in fact it leads to text slightly
+    // 'jumping' around by up to 1 pixel (of course).
+    // We paint text nowadays using decomposed TextPrimitives
+    // with sub-pixel precision and similar (using a shortcut)
+    // for text in TextEdit on the Overlay, also using sub-pixel
+    // precision. Just remove this to avoid Text being displayed
+    // different in TextEdit and EditView paint visualizations
+    // and assign given value to OutputArea unchanged.
+    maOutputArea = rRect;
+
     if (!maOutputArea.IsWidthEmpty() && maOutputArea.Right() < 
maOutputArea.Left())
         maOutputArea.SetRight(maOutputArea.Left());
     if (!maOutputArea.IsHeightEmpty() && maOutputArea.Bottom() < 
maOutputArea.Top())

Reply via email to