svx/source/sdr/overlay/overlaymanagerbuffered.cxx |    9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

New commits:
commit e76027164821b43c4cb79f25381ac35699b09516
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Nov 16 17:27:15 2022 +0000
Commit:     Michael Stahl <michael.st...@allotropia.de>
CommitDate: Thu Nov 17 11:29:59 2022 +0100

    tdf#149322 apparent distortion of glyphs on scrolling
    
    sometimes there's a 1 pixel difference here vs to the amount seen in
    Window::Scroll. The little misplaced tails of glyphs are actually in the
    right place, and it is the large rectangle of copied text above those
    that is in the wrong place.
    
    Subtract these origins while in logic space, before turning that
    result back to pixels to get consistent results for equal distances.
    
    Change-Id: I37e77f38b95456cee32ff44cde2893986d52cde3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142795
    Tested-by: Jenkins
    Reviewed-by: Michael Stahl <michael.st...@allotropia.de>

diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx 
b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
index 19babd089e54..ae37c2ce4f32 100644
--- a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
+++ b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
@@ -52,11 +52,13 @@ namespace sdr::overlay
                     const Point& rOriginNew = 
getOutputDevice().GetMapMode().GetOrigin();
                     const bool bScrolled(rOriginOld != rOriginNew);
 
+
                     if(bScrolled)
                     {
-                        // get pixel bounds
-                        const Point 
aOriginOldPixel(mpBufferDevice->LogicToPixel(rOriginOld));
-                        const Point 
aOriginNewPixel(mpBufferDevice->LogicToPixel(rOriginNew));
+                        // get pixel bounds (tdf#149322 do subtraction in 
logic units before converting result back to pixel)
+                        const Point aLogicOriginDiff(rOriginNew - rOriginOld);
+                        const Size 
aPixelOriginDiff(mpBufferDevice->LogicToPixel(Size(aLogicOriginDiff.X(), 
aLogicOriginDiff.Y())));
+                        const Point 
aDestinationOffsetPixel(aPixelOriginDiff.Width(), aPixelOriginDiff.Height());
                         const Size 
aOutputSizePixel(mpBufferDevice->GetOutputSizePixel());
 
                         // remember and switch off MapMode
@@ -64,7 +66,6 @@ namespace sdr::overlay
                         mpBufferDevice->EnableMapMode(false);
 
                         // scroll internally buffered stuff
-                        const Point aDestinationOffsetPixel(aOriginNewPixel - 
aOriginOldPixel);
                         mpBufferDevice->DrawOutDev(
                             aDestinationOffsetPixel, aOutputSizePixel, // 
destination
                             Point(), aOutputSizePixel); // source

Reply via email to