diff options
author | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-07-03 14:46:32 +0200 |
---|---|---|
committer | Andrzej Hunt <andrzej.hunt@collabora.com> | 2014-07-11 16:34:54 +0200 |
commit | 8265a55aa036d2453521723ca57e9ef27228639b (patch) | |
tree | 3aa8c580105a64f395d8047d931f737df02bb331 | |
parent | b539322e04f1a9ea797725309c0797952935c72c (diff) |
Use logic units for visible-cells determination.
This eliminates a bunch of LogicToPixel conversions, and also
means that tiles starting other than the origin are correctly
processed (as LogicToPixel run on a rectangle will also move that
rectangle depending on the origin set in the output device).
Change-Id: I42903fe23ad5f6baa1d5276d5dcc7ee038bd27cf
-rw-r--r-- | sc/source/ui/view/gridwin4.cxx | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx index e752559472b8..34e085b3eaa0 100644 --- a/sc/source/ui/view/gridwin4.cxx +++ b/sc/source/ui/view/gridwin4.cxx @@ -341,46 +341,44 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev ) bIsInPaint = true; - Rectangle aPixRect = pOutDev->LogicToPixel( rRect ); - SCCOL nX1 = pViewData->GetPosX(eHWhich); SCROW nY1 = pViewData->GetPosY(eVWhich); SCTAB nTab = pViewData->GetTabNo(); - Rectangle aMirroredPixel = aPixRect; + Rectangle aMirroredRect = rRect; if ( pDoc->IsLayoutRTL( nTab ) ) { // mirror and swap - long nWidth = GetSizePixel().Width(); - aMirroredPixel.Left() = nWidth - 1 - aPixRect.Right(); - aMirroredPixel.Right() = nWidth - 1 - aPixRect.Left(); + long nWidth = PixelToLogic(GetSizePixel()).Width(); + aMirroredRect.Left() = nWidth - 1 - rRect.Right(); + aMirroredRect.Right() = nWidth - 1 - rRect.Left(); } - long nScrX = pOutDev->LogicToPixel( Point( pDoc->GetColWidth( nX1, nTab ), 0 ) ).getX();/*ScViewData::ToPixel( pDoc->GetColWidth( nX1, nTab ), nPPTX );*/ - while ( nScrX <= aMirroredPixel.Left() && nX1 < MAXCOL ) + long nScrX = pDoc->GetColWidth( nX1, nTab ); + while ( nScrX <= aMirroredRect.Left() && nX1 < MAXCOL ) { ++nX1; - nScrX += pOutDev->LogicToPixel( Point( pDoc->GetColWidth( nX1, nTab ), 0 ) ).getX(); + nScrX += pDoc->GetColWidth( nX1, nTab ); } SCCOL nX2 = nX1; - while ( nScrX <= aMirroredPixel.Right() && nX2 < MAXCOL ) + while ( nScrX <= aMirroredRect.Right() && nX2 < MAXCOL ) { ++nX2; - nScrX += pOutDev->LogicToPixel( Point( pDoc->GetColWidth( nX2, nTab ), 0 ) ).getX(); + nScrX += pDoc->GetColWidth( nX2, nTab ); } long nScrY = 0; - while ( nScrY < aPixRect.Top() && nY1 < MAXROW ) + while ( nScrY < rRect.Top() && nY1 < MAXROW ) { ++nY1; - nScrY += pOutDev->LogicToPixel( Point( 0, pDoc->GetRowHeight( nY1, nTab ) ) ).getY(); + nScrY += pDoc->GetRowHeight( nY1, nTab ); } SCROW nY2 = nY1; - while ( nScrY <= aPixRect.Bottom() && nY2 < MAXROW ) + while ( nScrY <= rRect.Bottom() && nY2 < MAXROW ) { ++nY2; - nScrY += pOutDev->LogicToPixel( Point( 0, pDoc->GetRowHeight( nY2, nTab ) ) ).getY(); + nScrY += pDoc->GetRowHeight( nY2, nTab ); } // We specifically need to set the visible range here -- by default it is |