[Libreoffice-commits] core.git: sc/source

Mike Kaganski (via logerrit) logerrit at kemper.freedesktop.org
Tue May 11 19:50:32 UTC 2021


 sc/source/ui/view/tabview3.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 05f8f239d49bd66145e736b4e2e28ad073ef6f2f
Author:     Mike Kaganski <mike.kaganski at collabora.com>
AuthorDate: Tue May 11 21:03:19 2021 +0200
Commit:     Mike Kaganski <mike.kaganski at collabora.com>
CommitDate: Tue May 11 21:49:36 2021 +0200

    tdf#139241: partially revert 059f07f9f33460c809a93e0fda1165f5c6f6d805
    
    And instead normalize the start and end values before creating
    rectangle.
    
    Change-Id: Ib9921f1a537ca88a70cedf989d2f696180ad68e7
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115284
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kaganski at collabora.com>

diff --git a/sc/source/ui/view/tabview3.cxx b/sc/source/ui/view/tabview3.cxx
index 4bca2a4d92f8..3273999128d2 100644
--- a/sc/source/ui/view/tabview3.cxx
+++ b/sc/source/ui/view/tabview3.cxx
@@ -66,6 +66,8 @@
 #include <LibreOfficeKit/LibreOfficeKitEnums.h>
 #include <output.hxx>
 
+#include <utility>
+
 #include <com/sun/star/chart2/data/HighlightedRange.hpp>
 
 namespace
@@ -2686,9 +2688,11 @@ void ScTabView::PaintTopArea( SCCOL nStartCol, SCCOL nEndCol )
             tools::Long nStartX = aViewData.GetScrPos( nStartCol, 0, eWhich ).X();
             tools::Long nEndX;
             if (nEndCol >= rDoc.MaxCol())
-                nEndX = nStartX + (bLayoutRTL ? 0 : ( aWinSize.Width()-1 ));
+                nEndX = bLayoutRTL ? 0 : ( aWinSize.Width()-1 );
             else
                 nEndX = aViewData.GetScrPos( nEndCol+1, 0, eWhich ).X() - nLayoutSign;
+            if (nStartX > nEndX)
+                std::swap(nStartX, nEndX);
             pColBar[eWhich]->Invalidate(
                     tools::Rectangle( nStartX, 0, nEndX, aWinSize.Height()-1 ) );
         }
@@ -2739,9 +2743,11 @@ void ScTabView::PaintLeftArea( SCROW nStartRow, SCROW nEndRow )
             tools::Long nStartY = aViewData.GetScrPos( 0, nStartRow, eWhich ).Y();
             tools::Long nEndY;
             if (nEndRow >= rDoc.MaxRow())
-                nEndY = nStartY + aWinSize.Height() - 1;
+                nEndY = aWinSize.Height() - 1;
             else
                 nEndY = aViewData.GetScrPos( 0, nEndRow+1, eWhich ).Y() - 1;
+            if (nStartY > nEndY)
+                std::swap(nStartY, nEndY);
             pRowBar[eWhich]->Invalidate(
                     tools::Rectangle( 0, nStartY, aWinSize.Width()-1, nEndY ) );
         }


More information about the Libreoffice-commits mailing list