summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrzej Hunt <andrzej.hunt@collabora.com>2014-08-08 13:47:30 +0200
committerAndrzej Hunt <andrzej.hunt@collabora.com>2014-08-08 13:47:30 +0200
commitaac188abd53dde9e169919926cc6e8767462259c (patch)
treee4a0fa26f039ae80f4f81c8049b94e252460769e
parentf61391f24adb189dee2656d06478e24f69db24ea (diff)
TEMPORARY: use a different paint rect. feature/calctiledrendering5
Change-Id: I5fca6c31d0a526aa0a393d2bf68aeda81962ae36
-rw-r--r--sc/source/ui/inc/gridwin.hxx3
-rw-r--r--sc/source/ui/view/gridwin.cxx6
-rw-r--r--sc/source/ui/view/gridwin4.cxx36
3 files changed, 28 insertions, 17 deletions
diff --git a/sc/source/ui/inc/gridwin.hxx b/sc/source/ui/inc/gridwin.hxx
index af8b87ef4d90..e0d7452a0872 100644
--- a/sc/source/ui/inc/gridwin.hxx
+++ b/sc/source/ui/inc/gridwin.hxx
@@ -182,7 +182,8 @@ class ScGridWindow : public Window, public DropTargetHelper, public DragSourceHe
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 621ec01dcf4b..659096f3e122 100644
--- a/sc/source/ui/view/gridwin.cxx
+++ b/sc/source/ui/view/gridwin.cxx
@@ -4608,7 +4608,7 @@ void ScGridWindow::UpdateFormulas()
// (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 @@ void ScGridWindow::UpdateListValPos( bool bVisible, const ScAddress& rPos )
if ( !bOldButton || aListValPos != aOldPos )
{
// paint area of new button
- Invalidate( PixelToLogic( GetListValButtonRect( aListValPos ) ) );
+ Invalidate( GetListValButtonRect( aListValPos ) );
}
}
if ( bOldButton )
@@ -4704,7 +4704,7 @@ void ScGridWindow::UpdateListValPos( bool bVisible, const ScAddress& rPos )
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 ef9ffcbab3b1..09403b0be137 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -322,9 +322,14 @@ void ScGridWindow::Paint( const Rectangle& rRect )
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 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
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 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
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 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
}
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 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
// 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 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
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 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
nY1 = maVisibleRange.mnRow1;
if (nX1 > maVisibleRange.mnCol2 || nY1 > maVisibleRange.mnRow2)
+ {
return;
+ }
if (nX2 > maVisibleRange.mnCol2)
nX2 = maVisibleRange.mnCol2;
@@ -1015,11 +1025,11 @@ void ScGridWindow::CheckNeedsRepaint()
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();