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

Kohei Yoshida kohei.yoshida at collabora.com
Fri Jan 16 12:40:13 PST 2015


 sc/source/ui/view/gridwin4.cxx |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 4bd05b8abc801714e2bac1a9b239fa625de1178c
Author: Kohei Yoshida <kohei.yoshida at collabora.com>
Date:   Fri Jan 16 15:36:29 2015 -0500

    Correctly offset based on tile position.
    
    This works well at 100% zoom, but the offsets are still not correct
    at zoom levels other than 100%.
    
    Change-Id: I301362b00ca916410b69f39aa58ed871ce177d88

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 366eb28..b906bd4 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -874,7 +874,7 @@ void ScGridWindow::Draw( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ScUpdateMod
 
 void ScGridWindow::PaintTile( VirtualDevice& rDevice,
                               int nOutputWidth, int nOutputHeight,
-                              int /*nTilePosX*/, int /*nTilePosY*/,
+                              int nTilePosX, int nTilePosY,
                               long nTileWidth, long nTileHeight )
 {
     // Output size is in pixels while tile position and size are in logical units (twips).
@@ -898,7 +898,8 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
     pViewData->SetZoom(aFracX, aFracY, true);
     pViewData->RefreshZoom();
 
-    rDevice.SetOutputSizePixel(Size(nOutputWidth, nOutputHeight));
+    double fTilePosXPixel = static_cast<double>(nTilePosX) * PIXEL_PER_TWIPS;
+    double fTilePosYPixel = static_cast<double>(nTilePosY) * PIXEL_PER_TWIPS;
 
     SCTAB nTab = pViewData->GetTabNo();
     ScDocument* pDoc = pViewData->GetDocument();
@@ -914,7 +915,7 @@ void ScGridWindow::PaintTile( VirtualDevice& rDevice,
     pDoc->FillInfo(aTabInfo, nCol1, nRow1, nCol2, nRow2, nTab, fPPTX, fPPTY, false, false, NULL);
 
     ScOutputData aOutData(
-        &rDevice, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab, 0, 0, nCol1, nRow1, nCol2, nRow2, fPPTX, fPPTY);
+        &rDevice, OUTTYPE_WINDOW, aTabInfo, pDoc, nTab, -fTilePosXPixel, -fTilePosYPixel, nCol1, nRow1, nCol2, nRow2, fPPTX, fPPTY);
 
     const svtools::ColorConfig& rColorCfg = SC_MOD()->GetColorConfig();
     Color aGridColor = rColorCfg.GetColorValue(svtools::CALCGRID, false).nColor;


More information about the Libreoffice-commits mailing list