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

New commits:
commit 7060192b6facd92cadb5bb084052903f2695d67d
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Nov 16 17:27:15 2022 +0000
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Nov 16 20:35:46 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/+/142789
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/svx/source/sdr/overlay/overlaymanagerbuffered.cxx 
b/svx/source/sdr/overlay/overlaymanagerbuffered.cxx
index 365171757934..0e62cd73a37a 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