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

Krisztian Pinter pin.terminator at gmail.com
Fri Jul 10 08:44:56 PDT 2015


 sc/source/ui/inc/output.hxx    |    2 -
 sc/source/ui/view/gridwin4.cxx |    2 -
 sc/source/ui/view/output.cxx   |   56 ++++++++++++++++++++---------------------
 sc/source/ui/view/printfun.cxx |    4 +-
 4 files changed, 32 insertions(+), 32 deletions(-)

New commits:
commit dfd7ff70a758061f67d2fce0b09de0d5076ac42a
Author: Krisztian Pinter <pin.terminator at gmail.com>
Date:   Sun Jun 14 16:34:56 2015 +0200

    calc mapmode: Add explicit RenderContext passing
    
    Change-Id: I52d9c84bc6658348c249870088c38512ae169a34
    Reviewed-on: https://gerrit.libreoffice.org/16277
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan Holesovsky <kendy at collabora.com>

diff --git a/sc/source/ui/inc/output.hxx b/sc/source/ui/inc/output.hxx
index a7b96f7..d577efa 100644
--- a/sc/source/ui/inc/output.hxx
+++ b/sc/source/ui/inc/output.hxx
@@ -304,7 +304,7 @@ public:
     Rectangle LayoutStrings(bool bPixelToLogic = false, bool bPaint = true, const ScAddress &rAddress = ScAddress());
 
     void    DrawDocumentBackground();
-    void    DrawBackground();
+    void    DrawBackground(vcl::RenderContext& rRenderContext);
     void    DrawShadow();
     void    DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBottom);
     void    DrawFrame();
diff --git a/sc/source/ui/view/gridwin4.cxx b/sc/source/ui/view/gridwin4.cxx
index 9a0dfd6..4432653a 100644
--- a/sc/source/ui/view/gridwin4.cxx
+++ b/sc/source/ui/view/gridwin4.cxx
@@ -725,7 +725,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
     MapMode aPrevMapMode = pContentDev->GetMapMode();
     pContentDev->SetMapMode(MAP_PIXEL);
 
-    aOutputData.DrawBackground();
+    aOutputData.DrawBackground(*pContentDev);
 
     pContentDev->SetMapMode(aPrevMapMode);
 
diff --git a/sc/source/ui/view/output.cxx b/sc/source/ui/view/output.cxx
index a2cc326..388b0e8 100644
--- a/sc/source/ui/view/output.cxx
+++ b/sc/source/ui/view/output.cxx
@@ -789,7 +789,7 @@ namespace {
 
 static const double lclCornerRectTransparency = 40.0;
 
-void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, vcl::RenderContext* pDev, const Rectangle& rRect)
+void drawDataBars(vcl::RenderContext& rRenderContext, const ScDataBarInfo* pOldDataBarInfo, const Rectangle& rRect)
 {
     long nPosZero = 0;
     Rectangle aPaintRect = rRect;
@@ -825,7 +825,7 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, vcl::RenderContext* pDe
 
     if(pOldDataBarInfo->mbGradient)
     {
-        pDev->SetLineColor(pOldDataBarInfo->maColor);
+        rRenderContext.SetLineColor(pOldDataBarInfo->maColor);
         Gradient aGradient(GradientStyle_LINEAR, pOldDataBarInfo->maColor, COL_TRANSPARENT);
 
         if(pOldDataBarInfo->mnLength < 0)
@@ -833,14 +833,14 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, vcl::RenderContext* pDe
         else
             aGradient.SetAngle(900);
 
-        pDev->DrawGradient(aPaintRect, aGradient);
+        rRenderContext.DrawGradient(aPaintRect, aGradient);
 
-        pDev->SetLineColor();
+        rRenderContext.SetLineColor();
     }
     else
     {
-        pDev->SetFillColor(pOldDataBarInfo->maColor);
-        pDev->DrawRect(aPaintRect);
+        rRenderContext.SetFillColor(pOldDataBarInfo->maColor);
+        rRenderContext.DrawRect(aPaintRect);
     }
 
     //draw axis
@@ -852,11 +852,11 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, vcl::RenderContext* pDe
         aLineInfo.SetDashCount( 4 );
         aLineInfo.SetDistance( 3 );
         aLineInfo.SetDashLen( 3 );
-        pDev->SetFillColor(pOldDataBarInfo->maAxisColor);
-        pDev->SetLineColor(pOldDataBarInfo->maAxisColor);
-        pDev->DrawLine(aPoint1, aPoint2, aLineInfo);
-        pDev->SetLineColor();
-        pDev->SetFillColor();
+        rRenderContext.SetFillColor(pOldDataBarInfo->maAxisColor);
+        rRenderContext.SetLineColor(pOldDataBarInfo->maAxisColor);
+        rRenderContext.DrawLine(aPoint1, aPoint2, aLineInfo);
+        rRenderContext.SetLineColor();
+        rRenderContext.SetFillColor();
     }
 }
 
@@ -865,18 +865,18 @@ BitmapEx& getIcon( ScIconSetType eType, sal_Int32 nIndex )
     return ScIconSetFormat::getBitmap( eType, nIndex );
 }
 
-void drawIconSets( const ScIconSetInfo* pOldIconSetInfo, vcl::RenderContext* pDev, const Rectangle& rRect )
+void drawIconSets(vcl::RenderContext& rRenderContext, const ScIconSetInfo* pOldIconSetInfo, const Rectangle& rRect)
 {
     //long nSize = 16;
     ScIconSetType eType = pOldIconSetInfo->eIconSetType;
     sal_Int32 nIndex = pOldIconSetInfo->nIconIndex;
     BitmapEx& rIcon = getIcon( eType, nIndex );
     long aOrigSize = std::max<long>(0,std::min(rRect.GetSize().getWidth() - 4, rRect.GetSize().getHeight() -4));
-    pDev->DrawBitmapEx( Point( rRect.Left() +2, rRect.Top() + 2 ), Size(aOrigSize, aOrigSize), rIcon );
+    rRenderContext.DrawBitmapEx( Point( rRect.Left() +2, rRect.Top() + 2 ), Size(aOrigSize, aOrigSize), rIcon );
 }
 
-void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color*& pOldColor, const SvxBrushItem*& pOldBackground,
-        Rectangle& rRect, long nPosX, long nSignedOneX, vcl::RenderContext* pDev, const ScDataBarInfo* pDataBarInfo, const ScDataBarInfo*& pOldDataBarInfo,
+void drawCells(vcl::RenderContext& rRenderContext, const Color* pColor, const SvxBrushItem* pBackground, const Color*& pOldColor, const SvxBrushItem*& pOldBackground,
+        Rectangle& rRect, long nPosX, long nSignedOneX, const ScDataBarInfo* pDataBarInfo, const ScDataBarInfo*& pOldDataBarInfo,
         const ScIconSetInfo* pIconSetInfo, const ScIconSetInfo*& pOldIconSetInfo)
 {
 
@@ -888,13 +888,13 @@ void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color
         rRect.Right() = nPosX-nSignedOneX;
         if( !pOldColor->GetTransparency() )
         {
-            pDev->SetFillColor( *pOldColor );
-            pDev->DrawRect( rRect );
+            rRenderContext.SetFillColor( *pOldColor );
+            rRenderContext.DrawRect( rRect );
         }
         if( pOldDataBarInfo )
-            drawDataBars( pOldDataBarInfo, pDev, rRect );
+            drawDataBars(rRenderContext, pOldDataBarInfo, rRect );
         if( pOldIconSetInfo )
-            drawIconSets( pOldIconSetInfo, pDev, rRect );
+            drawIconSets(rRenderContext, pOldIconSetInfo, rRect );
 
         rRect.Left() = nPosX - nSignedOneX;
     }
@@ -907,14 +907,14 @@ void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color
             Color aBackCol = pOldBackground->GetColor();
             if ( !aBackCol.GetTransparency() )      //! partial transparency?
             {
-                pDev->SetFillColor( aBackCol );
-                pDev->DrawRect( rRect );
+                rRenderContext.SetFillColor( aBackCol );
+                rRenderContext.DrawRect( rRect );
             }
         }
         if( pOldDataBarInfo )
-            drawDataBars( pOldDataBarInfo, pDev, rRect );
+            drawDataBars(rRenderContext, pOldDataBarInfo, rRect );
         if( pOldIconSetInfo )
-            drawIconSets( pOldIconSetInfo, pDev, rRect );
+            drawIconSets(rRenderContext, pOldIconSetInfo, rRect );
 
         rRect.Left() = nPosX - nSignedOneX;
     }
@@ -952,12 +952,12 @@ void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color
 
 }
 
-void ScOutputData::DrawBackground()
+void ScOutputData::DrawBackground(vcl::RenderContext& rRenderContext)
 {
     FindRotated();              //! from the outside?
 
     Rectangle aRect;
-    Size aOnePixel = mpDev->PixelToLogic(Size(1,1));
+    Size aOnePixel = rRenderContext.PixelToLogic(Size(1,1));
     long nOneX = aOnePixel.Width();
     long nOneY = aOnePixel.Height();
 
@@ -967,7 +967,7 @@ void ScOutputData::DrawBackground()
     long nLayoutSign = bLayoutRTL ? -1 : 1;
     long nSignedOneX = nOneX * nLayoutSign;
 
-    mpDev->SetLineColor();
+    rRenderContext.SetLineColor();
 
     bool bShowProt = mbSyntaxMode && mpDoc->IsTabProtected(nTab);
     bool bDoAll = bShowProt || bPagebreakMode || bSolidBackground;
@@ -1055,7 +1055,7 @@ void ScOutputData::DrawBackground()
                     const Color* pColor = pInfo->pColorScale.get();
                     const ScDataBarInfo* pDataBarInfo = pInfo->pDataBar.get();
                     const ScIconSetInfo* pIconSetInfo = pInfo->pIconSet.get();
-                    drawCells( pColor, pBackground, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo );
+                    drawCells(rRenderContext, pColor, pBackground, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, pDataBarInfo, pOldDataBarInfo, pIconSetInfo, pOldIconSetInfo);
 
                     // extend for all merged cells
                     nMergedCells = 1;
@@ -1071,7 +1071,7 @@ void ScOutputData::DrawBackground()
                         nPosX += pRowInfo[0].pCellInfo[nX+nOldMerged+nMerged].nWidth * nLayoutSign;
                     }
                 }
-                drawCells( NULL, NULL, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, mpDev, NULL, pOldDataBarInfo, NULL, pOldIconSetInfo );
+                drawCells(rRenderContext, NULL, NULL, pOldColor, pOldBackground, aRect, nPosX, nSignedOneX, NULL, pOldDataBarInfo, NULL, pOldIconSetInfo);
 
                 nArrY += nSkip;
             }
diff --git a/sc/source/ui/view/printfun.cxx b/sc/source/ui/view/printfun.cxx
index 8849b5e..9c13269 100644
--- a/sc/source/ui/view/printfun.cxx
+++ b/sc/source/ui/view/printfun.cxx
@@ -548,7 +548,7 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr
     if (!bMetaFile && pViewData)
         pDev->SetMapMode(aMode);
 
-    aOutputData.DrawBackground();
+    aOutputData.DrawBackground(*pDev);
     aOutputData.DrawShadow();
     aOutputData.DrawFrame();
     aOutputData.DrawStrings();
@@ -1604,7 +1604,7 @@ void ScPrintFunc::PrintArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
     }
 
     if( aTableParam.bCellContent )
-        aOutputData.DrawBackground();
+        aOutputData.DrawBackground(*pDev);
 
     pDev->SetClipRegion(vcl::Region(Rectangle(
                 aPos, Size(aOutputData.GetScrW(), aOutputData.GetScrH()))));


More information about the Libreoffice-commits mailing list