TEMPORARY: use a different paint rect.

Change-Id: I5fca6c31d0a526aa0a393d2bf68aeda81962ae36
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index af8b87e..e0d7452 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -182,7 +182,8 @@
     Point                   aCurMousePos;
 
     sal_uInt16              nPaintCount;
-    Rectangle               aRepaintPixel;
+    // The area to be repainted, in logic coordinates.
+    Rectangle               aRepaintRect;
 
     ScAddress               aAutoMarkPos;
     ScAddress               aListValPos;
diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx
index 621ec01..659096f 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4608,7 +4608,7 @@
         //  (dann wuerde zumindest der MapMode nicht mehr stimmen)
 
         bNeedsRepaint = true;           // -> am Ende vom Paint nochmal Invalidate auf alles
-        aRepaintPixel = Rectangle();    // alles
+        aRepaintRect = Rectangle();    // alles
         return;
     }
 
@@ -4696,7 +4696,7 @@
         if ( !bOldButton || aListValPos != aOldPos )
         {
             // paint area of new button
-            Invalidate( PixelToLogic( GetListValButtonRect( aListValPos ) ) );
+            Invalidate( GetListValButtonRect( aListValPos ) );
         }
     }
     if ( bOldButton )
@@ -4704,7 +4704,7 @@
         if ( !bListValButton || aListValPos != aOldPos )
         {
             // paint area of old button
-            Invalidate( PixelToLogic( GetListValButtonRect( aOldPos ) ) );
+            Invalidate( GetListValButtonRect( aOldPos ) );
         }
     }
 }
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index ef9ffcb..09403b0 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -322,9 +322,14 @@
     EnableMapMode( false );
 }
 
-void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
+void ScGridWindow::Paint( const Rectangle& rPixRect, OutputDevice* pOutDev )
 {
+    // Convert Pix to logic
+    const Rectangle aLogicRect = PixelToLogic( rPixRect );
+
+//    const Rectangle aLogicRect = rPixRect;
     ScDocument* pDoc = pViewData->GetDocument();
+
     if ( pDoc->IsInInterpreter() )
     {
         //  via Reschedule, interpretierende Zellen nicht nochmal anstossen
@@ -334,12 +339,14 @@
         if ( bNeedsRepaint )
         {
             //! Rechtecke zusammenfassen?
-            aRepaintPixel = Rectangle();            // mehrfach -> alles painten
+            aRepaintRect = Rectangle();            // mehrfach -> alles painten
         }
         else
         {
             bNeedsRepaint = true;
-            aRepaintPixel = LogicToPixel(rRect);    // nur betroffenen Bereich
+            // Yes -- this is reused for another paint call, hence we need
+            // to keep pixel coordinates.
+            aRepaintRect = rPixRect;
         }
         return;
     }
@@ -366,13 +373,13 @@
 
     SCTAB nTab = pViewData->GetTabNo();
 
-    Rectangle aMirroredRect = rRect;
+    Rectangle aMirroredRect = aLogicRect;
     if ( pDoc->IsLayoutRTL( nTab ) )
     {
         //  mirror and swap
-        long nWidth = PixelToLogic(GetSizePixel()).Width();
-        aMirroredRect.Left()  = nWidth - 1 - rRect.Right();
-        aMirroredRect.Right() = nWidth - 1 - rRect.Left();
+        long nWidth = GetSizePixel().Width();
+        aMirroredRect.Left()  = nWidth - 1 - aLogicRect.Right();
+        aMirroredRect.Right() = nWidth - 1 - aLogicRect.Left();
     }
 
     long nScrX = pDoc->GetColWidth( nX1, nTab );
@@ -389,13 +396,13 @@
     }
 
     long nScrY = 0;
-    while ( nScrY < rRect.Top() && nY1 < MAXROW )
+    while ( nScrY < aLogicRect.Top() && nY1 < MAXROW )
     {
         ++nY1;
         nScrY += pDoc->GetRowHeight( nY1, nTab );
     }
     SCROW nY2 = nY1;
-    while ( nScrY <= rRect.Bottom() && nY2 < MAXROW )
+    while ( nScrY <= aLogicRect.Bottom() && nY2 < MAXROW )
     {
         ++nY2;
         nScrY += pDoc->GetRowHeight( nY2, nTab );
@@ -413,6 +420,7 @@
     // set in UpdateVisibleRange which however uses the viewdata, which is
     // completely irrelevant for tiled rendering.
     maVisibleRange.set( nX1, nY1, nX2, nY2 );
+
     Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS, pOutDev );           // nicht weiterzeichnen
     bIsInPaint = false;
 }
@@ -481,7 +489,7 @@
 
     OSL_ENSURE( ValidCol(nX2) && ValidRow(nY2), "GridWin Draw Bereich zu gross" );
 
-    UpdateVisibleRange();
+//    UpdateVisibleRange();
 
     if (nX2 < maVisibleRange.mnCol1 || nY2 < maVisibleRange.mnRow1)
         return;
@@ -492,7 +500,9 @@
         nY1 = maVisibleRange.mnRow1;
 
     if (nX1 > maVisibleRange.mnCol2 || nY1 > maVisibleRange.mnRow2)
+    {
         return;
+    }
 
     if (nX2 > maVisibleRange.mnCol2)
         nX2 = maVisibleRange.mnCol2;
@@ -1015,11 +1025,11 @@
     if (bNeedsRepaint)
     {
         bNeedsRepaint = false;
-        if (aRepaintPixel.IsEmpty())
+        if (aRepaintRect.IsEmpty())
             Invalidate();
         else
-            Invalidate(PixelToLogic(aRepaintPixel));
-        aRepaintPixel = Rectangle();
+            Invalidate(aRepaintRect);
+        aRepaintRect = Rectangle();
 
         // selection function in status bar might also be invalid
         SfxBindings& rBindings = pViewData->GetBindings();