Kaydet (Commit) dfd7ff70 authored tarafından Krisztian Pinter's avatar Krisztian Pinter Kaydeden (comit) Jan Holesovsky

calc mapmode: Add explicit RenderContext passing

Change-Id: I52d9c84bc6658348c249870088c38512ae169a34
Reviewed-on: https://gerrit.libreoffice.org/16277Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarJan Holesovsky <kendy@collabora.com>
üst 89cfc660
...@@ -304,7 +304,7 @@ public: ...@@ -304,7 +304,7 @@ public:
Rectangle LayoutStrings(bool bPixelToLogic = false, bool bPaint = true, const ScAddress &rAddress = ScAddress()); Rectangle LayoutStrings(bool bPixelToLogic = false, bool bPaint = true, const ScAddress &rAddress = ScAddress());
void DrawDocumentBackground(); void DrawDocumentBackground();
void DrawBackground(); void DrawBackground(vcl::RenderContext& rRenderContext);
void DrawShadow(); void DrawShadow();
void DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBottom); void DrawExtraShadow(bool bLeft, bool bTop, bool bRight, bool bBottom);
void DrawFrame(); void DrawFrame();
......
...@@ -725,7 +725,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI ...@@ -725,7 +725,7 @@ void ScGridWindow::DrawContent(OutputDevice &rDevice, const ScTableInfo& rTableI
MapMode aPrevMapMode = pContentDev->GetMapMode(); MapMode aPrevMapMode = pContentDev->GetMapMode();
pContentDev->SetMapMode(MAP_PIXEL); pContentDev->SetMapMode(MAP_PIXEL);
aOutputData.DrawBackground(); aOutputData.DrawBackground(*pContentDev);
pContentDev->SetMapMode(aPrevMapMode); pContentDev->SetMapMode(aPrevMapMode);
......
...@@ -789,7 +789,7 @@ namespace { ...@@ -789,7 +789,7 @@ namespace {
static const double lclCornerRectTransparency = 40.0; 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; long nPosZero = 0;
Rectangle aPaintRect = rRect; Rectangle aPaintRect = rRect;
...@@ -825,7 +825,7 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, vcl::RenderContext* pDe ...@@ -825,7 +825,7 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, vcl::RenderContext* pDe
if(pOldDataBarInfo->mbGradient) if(pOldDataBarInfo->mbGradient)
{ {
pDev->SetLineColor(pOldDataBarInfo->maColor); rRenderContext.SetLineColor(pOldDataBarInfo->maColor);
Gradient aGradient(GradientStyle_LINEAR, pOldDataBarInfo->maColor, COL_TRANSPARENT); Gradient aGradient(GradientStyle_LINEAR, pOldDataBarInfo->maColor, COL_TRANSPARENT);
if(pOldDataBarInfo->mnLength < 0) if(pOldDataBarInfo->mnLength < 0)
...@@ -833,14 +833,14 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, vcl::RenderContext* pDe ...@@ -833,14 +833,14 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, vcl::RenderContext* pDe
else else
aGradient.SetAngle(900); aGradient.SetAngle(900);
pDev->DrawGradient(aPaintRect, aGradient); rRenderContext.DrawGradient(aPaintRect, aGradient);
pDev->SetLineColor(); rRenderContext.SetLineColor();
} }
else else
{ {
pDev->SetFillColor(pOldDataBarInfo->maColor); rRenderContext.SetFillColor(pOldDataBarInfo->maColor);
pDev->DrawRect(aPaintRect); rRenderContext.DrawRect(aPaintRect);
} }
//draw axis //draw axis
...@@ -852,11 +852,11 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, vcl::RenderContext* pDe ...@@ -852,11 +852,11 @@ void drawDataBars( const ScDataBarInfo* pOldDataBarInfo, vcl::RenderContext* pDe
aLineInfo.SetDashCount( 4 ); aLineInfo.SetDashCount( 4 );
aLineInfo.SetDistance( 3 ); aLineInfo.SetDistance( 3 );
aLineInfo.SetDashLen( 3 ); aLineInfo.SetDashLen( 3 );
pDev->SetFillColor(pOldDataBarInfo->maAxisColor); rRenderContext.SetFillColor(pOldDataBarInfo->maAxisColor);
pDev->SetLineColor(pOldDataBarInfo->maAxisColor); rRenderContext.SetLineColor(pOldDataBarInfo->maAxisColor);
pDev->DrawLine(aPoint1, aPoint2, aLineInfo); rRenderContext.DrawLine(aPoint1, aPoint2, aLineInfo);
pDev->SetLineColor(); rRenderContext.SetLineColor();
pDev->SetFillColor(); rRenderContext.SetFillColor();
} }
} }
...@@ -865,18 +865,18 @@ BitmapEx& getIcon( ScIconSetType eType, sal_Int32 nIndex ) ...@@ -865,18 +865,18 @@ BitmapEx& getIcon( ScIconSetType eType, sal_Int32 nIndex )
return ScIconSetFormat::getBitmap( eType, 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; //long nSize = 16;
ScIconSetType eType = pOldIconSetInfo->eIconSetType; ScIconSetType eType = pOldIconSetInfo->eIconSetType;
sal_Int32 nIndex = pOldIconSetInfo->nIconIndex; sal_Int32 nIndex = pOldIconSetInfo->nIconIndex;
BitmapEx& rIcon = getIcon( eType, nIndex ); BitmapEx& rIcon = getIcon( eType, nIndex );
long aOrigSize = std::max<long>(0,std::min(rRect.GetSize().getWidth() - 4, rRect.GetSize().getHeight() -4)); 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, void drawCells(vcl::RenderContext& rRenderContext, 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, Rectangle& rRect, long nPosX, long nSignedOneX, const ScDataBarInfo* pDataBarInfo, const ScDataBarInfo*& pOldDataBarInfo,
const ScIconSetInfo* pIconSetInfo, const ScIconSetInfo*& pOldIconSetInfo) const ScIconSetInfo* pIconSetInfo, const ScIconSetInfo*& pOldIconSetInfo)
{ {
...@@ -888,13 +888,13 @@ void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color ...@@ -888,13 +888,13 @@ void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color
rRect.Right() = nPosX-nSignedOneX; rRect.Right() = nPosX-nSignedOneX;
if( !pOldColor->GetTransparency() ) if( !pOldColor->GetTransparency() )
{ {
pDev->SetFillColor( *pOldColor ); rRenderContext.SetFillColor( *pOldColor );
pDev->DrawRect( rRect ); rRenderContext.DrawRect( rRect );
} }
if( pOldDataBarInfo ) if( pOldDataBarInfo )
drawDataBars( pOldDataBarInfo, pDev, rRect ); drawDataBars(rRenderContext, pOldDataBarInfo, rRect );
if( pOldIconSetInfo ) if( pOldIconSetInfo )
drawIconSets( pOldIconSetInfo, pDev, rRect ); drawIconSets(rRenderContext, pOldIconSetInfo, rRect );
rRect.Left() = nPosX - nSignedOneX; rRect.Left() = nPosX - nSignedOneX;
} }
...@@ -907,14 +907,14 @@ void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color ...@@ -907,14 +907,14 @@ void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color
Color aBackCol = pOldBackground->GetColor(); Color aBackCol = pOldBackground->GetColor();
if ( !aBackCol.GetTransparency() ) //! partial transparency? if ( !aBackCol.GetTransparency() ) //! partial transparency?
{ {
pDev->SetFillColor( aBackCol ); rRenderContext.SetFillColor( aBackCol );
pDev->DrawRect( rRect ); rRenderContext.DrawRect( rRect );
} }
} }
if( pOldDataBarInfo ) if( pOldDataBarInfo )
drawDataBars( pOldDataBarInfo, pDev, rRect ); drawDataBars(rRenderContext, pOldDataBarInfo, rRect );
if( pOldIconSetInfo ) if( pOldIconSetInfo )
drawIconSets( pOldIconSetInfo, pDev, rRect ); drawIconSets(rRenderContext, pOldIconSetInfo, rRect );
rRect.Left() = nPosX - nSignedOneX; rRect.Left() = nPosX - nSignedOneX;
} }
...@@ -952,12 +952,12 @@ void drawCells(const Color* pColor, const SvxBrushItem* pBackground, const Color ...@@ -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? FindRotated(); //! from the outside?
Rectangle aRect; Rectangle aRect;
Size aOnePixel = mpDev->PixelToLogic(Size(1,1)); Size aOnePixel = rRenderContext.PixelToLogic(Size(1,1));
long nOneX = aOnePixel.Width(); long nOneX = aOnePixel.Width();
long nOneY = aOnePixel.Height(); long nOneY = aOnePixel.Height();
...@@ -967,7 +967,7 @@ void ScOutputData::DrawBackground() ...@@ -967,7 +967,7 @@ void ScOutputData::DrawBackground()
long nLayoutSign = bLayoutRTL ? -1 : 1; long nLayoutSign = bLayoutRTL ? -1 : 1;
long nSignedOneX = nOneX * nLayoutSign; long nSignedOneX = nOneX * nLayoutSign;
mpDev->SetLineColor(); rRenderContext.SetLineColor();
bool bShowProt = mbSyntaxMode && mpDoc->IsTabProtected(nTab); bool bShowProt = mbSyntaxMode && mpDoc->IsTabProtected(nTab);
bool bDoAll = bShowProt || bPagebreakMode || bSolidBackground; bool bDoAll = bShowProt || bPagebreakMode || bSolidBackground;
...@@ -1055,7 +1055,7 @@ void ScOutputData::DrawBackground() ...@@ -1055,7 +1055,7 @@ void ScOutputData::DrawBackground()
const Color* pColor = pInfo->pColorScale.get(); const Color* pColor = pInfo->pColorScale.get();
const ScDataBarInfo* pDataBarInfo = pInfo->pDataBar.get(); const ScDataBarInfo* pDataBarInfo = pInfo->pDataBar.get();
const ScIconSetInfo* pIconSetInfo = pInfo->pIconSet.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 // extend for all merged cells
nMergedCells = 1; nMergedCells = 1;
...@@ -1071,7 +1071,7 @@ void ScOutputData::DrawBackground() ...@@ -1071,7 +1071,7 @@ void ScOutputData::DrawBackground()
nPosX += pRowInfo[0].pCellInfo[nX+nOldMerged+nMerged].nWidth * nLayoutSign; 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; nArrY += nSkip;
} }
......
...@@ -548,7 +548,7 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr ...@@ -548,7 +548,7 @@ void ScPrintFunc::DrawToDev( ScDocument* pDoc, OutputDevice* pDev, double /* nPr
if (!bMetaFile && pViewData) if (!bMetaFile && pViewData)
pDev->SetMapMode(aMode); pDev->SetMapMode(aMode);
aOutputData.DrawBackground(); aOutputData.DrawBackground(*pDev);
aOutputData.DrawShadow(); aOutputData.DrawShadow();
aOutputData.DrawFrame(); aOutputData.DrawFrame();
aOutputData.DrawStrings(); aOutputData.DrawStrings();
...@@ -1604,7 +1604,7 @@ void ScPrintFunc::PrintArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2, ...@@ -1604,7 +1604,7 @@ void ScPrintFunc::PrintArea( SCCOL nX1, SCROW nY1, SCCOL nX2, SCROW nY2,
} }
if( aTableParam.bCellContent ) if( aTableParam.bCellContent )
aOutputData.DrawBackground(); aOutputData.DrawBackground(*pDev);
pDev->SetClipRegion(vcl::Region(Rectangle( pDev->SetClipRegion(vcl::Region(Rectangle(
aPos, Size(aOutputData.GetScrW(), aOutputData.GetScrH())))); aPos, Size(aOutputData.GetScrW(), aOutputData.GetScrH()))));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment