[Libreoffice-commits] core.git: Branch 'feature/gtkbmptiledviewer2' - 3 commits - sc/source

Andrzej Hunt andrzej.hunt at collabora.com
Sun Jun 22 23:47:09 PDT 2014


 sc/source/ui/view/gridwin4.cxx |    5 +++++
 1 file changed, 5 insertions(+)

New commits:
commit eac80c76f79b3dda52eb8c015e1309c0b570d45b
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Fri Jun 20 14:15:16 2014 +0100

    Revert "Use output device scaling to determine cells in draw-area."
    
    This reverts commit 9fd5c03c80f92aabfd0cbf91fa80a811518995bd.

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 470f150..83204fc 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -347,6 +347,9 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
 
     SCTAB nTab = pViewData->GetTabNo();
 
+    double nPPTX = pViewData->GetPPTX();
+    double nPPTY = pViewData->GetPPTY();
+
     Rectangle aMirroredPixel = aPixRect;
     if ( pDoc->IsLayoutRTL( nTab ) )
     {
@@ -356,30 +359,26 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
         aMirroredPixel.Right() = nWidth - 1 - aPixRect.Left();
     }
 
-    long nScrX = pOutDev->LogicToPixel( Point( pDoc->GetColWidth( nX1, nTab ), 0 ) ).getX();/*ScViewData::ToPixel( pDoc->GetColWidth( nX1, nTab ), nPPTX );*/
+    long nScrX = ScViewData::ToPixel( pDoc->GetColWidth( nX1, nTab ), nPPTX );
     while ( nScrX <= aMirroredPixel.Left() && nX1 < MAXCOL )
     {
         ++nX1;
-        nScrX += pOutDev->LogicToPixel( Point( pDoc->GetColWidth( nX1, nTab ), 0 ) ).getX();
+        nScrX += ScViewData::ToPixel( pDoc->GetColWidth( nX1, nTab ), nPPTX );
     }
     SCCOL nX2 = nX1;
     while ( nScrX <= aMirroredPixel.Right() && nX2 < MAXCOL )
     {
         ++nX2;
-        nScrX += pOutDev->LogicToPixel( Point( pDoc->GetColWidth( nX2, nTab ), 0 ) ).getX();
+        nScrX += ScViewData::ToPixel( pDoc->GetColWidth( nX2, nTab ), nPPTX );
     }
 
     long nScrY = 0;
-    while ( nScrY < aPixRect.Top() && nY1 < MAXROW )
-    {
-        ++nY1;
-        nScrY += pOutDev->LogicToPixel( Point( 0, pDoc->GetRowHeight( nY1, nTab ) ) ).getY();
-    }
+    ScViewData::AddPixelsWhile( nScrY, aPixRect.Top(), nY1, MAXROW, nPPTY, pDoc, nTab);
     SCROW nY2 = nY1;
-    while ( nScrY <= aPixRect.Bottom() && nY2 < MAXROW )
+    if (nScrY <= aPixRect.Bottom() && nY2 < MAXROW)
     {
         ++nY2;
-        nScrY += pOutDev->LogicToPixel( Point( 0, pDoc->GetRowHeight( nY2, nTab ) ) ).getY();
+        ScViewData::AddPixelsWhile( nScrY, aPixRect.Bottom(), nY2, MAXROW, nPPTY, pDoc, nTab);
     }
 
     Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS, pOutDev );           // nicht weiterzeichnen
commit 3b32c2a408eec2b101ecf68341239b8c2cc3247b
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Fri Jun 20 11:07:33 2014 +0100

    Set correct scaling for normal painting.
    
    As we no longer read the scaling from the viewdata, we should
    instead set it on the output device when doing normal rendering.
    
    However the grid still doesn't exactly match the external axes yet,
    there are probably more rounding errors wherever they are painted.
    
    Change-Id: I25b1bd9b344115578fe892aa94fbf753a3c10c81

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 28e75cc..470f150 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -301,6 +301,11 @@ void ScGridWindow::PrePaint()
 
 void ScGridWindow::Paint( const Rectangle& rRect )
 {
+    MapMode aMapMode( GetMapMode() );
+    aMapMode.SetMapUnit( MAP_TWIP );
+    aMapMode.SetScaleX( pViewData->GetZoomX() * Fraction(0.96) );
+    aMapMode.SetScaleY( pViewData->GetZoomY() * Fraction(0.96) );
+    SetMapMode( aMapMode );
     Paint( rRect, this );
 }
 
commit 9fd5c03c80f92aabfd0cbf91fa80a811518995bd
Author: Andrzej Hunt <andrzej.hunt at collabora.com>
Date:   Fri Jun 20 10:35:45 2014 +0100

    Use output device scaling to determine cells in draw-area.
    
    Change-Id: Idf4e6ccb72090a55b6a9234cafae21821e3df0b0

diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 89b6f26..28e75cc 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -342,9 +342,6 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
 
     SCTAB nTab = pViewData->GetTabNo();
 
-    double nPPTX = pViewData->GetPPTX();
-    double nPPTY = pViewData->GetPPTY();
-
     Rectangle aMirroredPixel = aPixRect;
     if ( pDoc->IsLayoutRTL( nTab ) )
     {
@@ -354,26 +351,30 @@ void ScGridWindow::Paint( const Rectangle& rRect, OutputDevice* pOutDev )
         aMirroredPixel.Right() = nWidth - 1 - aPixRect.Left();
     }
 
-    long nScrX = ScViewData::ToPixel( pDoc->GetColWidth( nX1, nTab ), nPPTX );
+    long nScrX = pOutDev->LogicToPixel( Point( pDoc->GetColWidth( nX1, nTab ), 0 ) ).getX();/*ScViewData::ToPixel( pDoc->GetColWidth( nX1, nTab ), nPPTX );*/
     while ( nScrX <= aMirroredPixel.Left() && nX1 < MAXCOL )
     {
         ++nX1;
-        nScrX += ScViewData::ToPixel( pDoc->GetColWidth( nX1, nTab ), nPPTX );
+        nScrX += pOutDev->LogicToPixel( Point( pDoc->GetColWidth( nX1, nTab ), 0 ) ).getX();
     }
     SCCOL nX2 = nX1;
     while ( nScrX <= aMirroredPixel.Right() && nX2 < MAXCOL )
     {
         ++nX2;
-        nScrX += ScViewData::ToPixel( pDoc->GetColWidth( nX2, nTab ), nPPTX );
+        nScrX += pOutDev->LogicToPixel( Point( pDoc->GetColWidth( nX2, nTab ), 0 ) ).getX();
     }
 
     long nScrY = 0;
-    ScViewData::AddPixelsWhile( nScrY, aPixRect.Top(), nY1, MAXROW, nPPTY, pDoc, nTab);
+    while ( nScrY < aPixRect.Top() && nY1 < MAXROW )
+    {
+        ++nY1;
+        nScrY += pOutDev->LogicToPixel( Point( 0, pDoc->GetRowHeight( nY1, nTab ) ) ).getY();
+    }
     SCROW nY2 = nY1;
-    if (nScrY <= aPixRect.Bottom() && nY2 < MAXROW)
+    while ( nScrY <= aPixRect.Bottom() && nY2 < MAXROW )
     {
         ++nY2;
-        ScViewData::AddPixelsWhile( nScrY, aPixRect.Bottom(), nY2, MAXROW, nPPTY, pDoc, nTab);
+        nScrY += pOutDev->LogicToPixel( Point( 0, pDoc->GetRowHeight( nY2, nTab ) ) ).getY();
     }
 
     Draw( nX1,nY1,nX2,nY2, SC_UPDATE_MARKS, pOutDev );           // nicht weiterzeichnen


More information about the Libreoffice-commits mailing list