summaryrefslogtreecommitdiff
path: root/vcl/source/graphic
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2021-05-18 11:44:12 +0100
committerCaolán McNamara <caolanm@redhat.com>2021-05-19 09:45:46 +0200
commit692c5df18ec1f558abe1a3a658c9881cfb7210a9 (patch)
treef9d6d6d6750ffcfa9401660314c0a1d61993766b /vcl/source/graphic
parent1815aa9472080b9dac263d393b9c922dd16351fe (diff)
ImplPlayWithRenderer never checks its OutputDevice against nullptr
just pass a reference instead and spread that around to some similar cases Change-Id: Ifb2dee8c7bf02a9f01982b928c90666cbbdd84fe Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115759 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl/source/graphic')
-rw-r--r--vcl/source/graphic/GraphicObject.cxx68
-rw-r--r--vcl/source/graphic/GraphicObject2.cxx46
2 files changed, 57 insertions, 57 deletions
diff --git a/vcl/source/graphic/GraphicObject.cxx b/vcl/source/graphic/GraphicObject.cxx
index b127b2d03c3d..c8230fd02555 100644
--- a/vcl/source/graphic/GraphicObject.cxx
+++ b/vcl/source/graphic/GraphicObject.cxx
@@ -96,8 +96,8 @@ void SearchForGraphics(uno::Reference<uno::XInterface> const & xInterface,
namespace
{
-bool lclDrawObj( OutputDevice* pOut, const Point& rPt, const Size& rSz,
- GraphicObject const & rObj, const GraphicAttr& rAttr)
+bool lclDrawObj(OutputDevice& rOut, const Point& rPt, const Size& rSz,
+ GraphicObject const & rObj, const GraphicAttr& rAttr)
{
Point aPt( rPt );
Size aSz( rSz );
@@ -122,7 +122,7 @@ bool lclDrawObj( OutputDevice* pOut, const Point& rPt, const Size& rSz,
aSz = aRotBoundRect.GetSize();
}
- aGraphic.Draw( pOut, aPt, aSz );
+ aGraphic.Draw(rOut, aPt, aSz);
}
bRet = true;
@@ -345,8 +345,8 @@ bool GraphicObject::IsEPS() const
return maGraphic.IsEPS();
}
-bool GraphicObject::ImplGetCropParams( OutputDevice const * pOut, Point& rPt, Size& rSz, const GraphicAttr* pAttr,
- tools::PolyPolygon& rClipPolyPoly, bool& bRectClipRegion ) const
+bool GraphicObject::ImplGetCropParams(const OutputDevice& rOut, Point& rPt, Size& rSz, const GraphicAttr* pAttr,
+ tools::PolyPolygon& rClipPolyPoly, bool& bRectClipRegion) const
{
bool bRet = false;
@@ -374,7 +374,7 @@ bool GraphicObject::ImplGetCropParams( OutputDevice const * pOut, Point& rPt, Si
else
{
MapMode m(maGraphic.GetPrefMapMode());
- aSize100 = pOut->LogicToLogic( maGraphic.GetPrefSize(), &m, &aMap100 );
+ aSize100 = rOut.LogicToLogic( maGraphic.GetPrefSize(), &m, &aMap100 );
}
nTotalWidth = aSize100.Width() - pAttr->GetLeftCrop() - pAttr->GetRightCrop();
@@ -456,17 +456,17 @@ void GraphicObject::SetUserData( const OUString& rUserData )
maUserData = rUserData;
}
-bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz,
- const GraphicAttr* pAttr )
+bool GraphicObject::Draw(OutputDevice& rOut, const Point& rPt, const Size& rSz,
+ const GraphicAttr* pAttr)
{
GraphicAttr aAttr( pAttr ? *pAttr : GetAttr() );
Point aPt( rPt );
Size aSz( rSz );
- const DrawModeFlags nOldDrawMode = pOut->GetDrawMode();
+ const DrawModeFlags nOldDrawMode = rOut.GetDrawMode();
bool bCropped = aAttr.IsCropped();
bool bRet;
- pOut->SetDrawMode( nOldDrawMode & ~DrawModeFlags( DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill | DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient ) );
+ rOut.SetDrawMode(nOldDrawMode & ~DrawModeFlags( DrawModeFlags::SettingsLine | DrawModeFlags::SettingsFill | DrawModeFlags::SettingsText | DrawModeFlags::SettingsGradient ));
// mirrored horizontally
if( aSz.Width() < 0 )
@@ -488,9 +488,9 @@ bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz,
{
tools::PolyPolygon aClipPolyPoly;
bool bRectClip;
- const bool bCrop = ImplGetCropParams( pOut, aPt, aSz, &aAttr, aClipPolyPoly, bRectClip );
+ const bool bCrop = ImplGetCropParams(rOut, aPt, aSz, &aAttr, aClipPolyPoly, bRectClip);
- pOut->Push( PushFlags::CLIPREGION );
+ rOut.Push(PushFlags::CLIPREGION);
if( bCrop )
{
@@ -499,36 +499,36 @@ bool GraphicObject::Draw( OutputDevice* pOut, const Point& rPt, const Size& rSz,
// #i29534# Store crop rect for later forwarding to
// PDF writer
tools::Rectangle aCropRect = aClipPolyPoly.GetBoundRect();
- pOut->IntersectClipRegion( aCropRect );
+ rOut.IntersectClipRegion(aCropRect);
}
else
{
- pOut->IntersectClipRegion(vcl::Region(aClipPolyPoly));
+ rOut.IntersectClipRegion(vcl::Region(aClipPolyPoly));
}
}
}
- bRet = lclDrawObj(pOut, aPt, aSz, *this, aAttr);
+ bRet = lclDrawObj(rOut, aPt, aSz, *this, aAttr);
if( bCropped )
- pOut->Pop();
+ rOut.Pop();
- pOut->SetDrawMode( nOldDrawMode );
+ rOut.SetDrawMode( nOldDrawMode );
return bRet;
}
-void GraphicObject::DrawTiled( OutputDevice* pOut, const tools::Rectangle& rArea, const Size& rSize,
- const Size& rOffset, int nTileCacheSize1D )
+void GraphicObject::DrawTiled(OutputDevice& rOut, const tools::Rectangle& rArea, const Size& rSize,
+ const Size& rOffset, int nTileCacheSize1D)
{
- if( pOut == nullptr || rSize.IsEmpty() )
+ if (rSize.IsEmpty())
return;
- const MapMode aOutMapMode( pOut->GetMapMode() );
+ const MapMode aOutMapMode(rOut.GetMapMode());
// #106258# Clamp size to 1 for zero values. This is okay, since
// logical size of zero is handled above already
- const Size aOutTileSize( ::std::max( tools::Long(1), pOut->LogicToPixel( rSize, aOutMapMode ).Width() ),
- ::std::max( tools::Long(1), pOut->LogicToPixel( rSize, aOutMapMode ).Height() ) );
+ const Size aOutTileSize( ::std::max( tools::Long(1), rOut.LogicToPixel( rSize, aOutMapMode ).Width() ),
+ ::std::max( tools::Long(1), rOut.LogicToPixel( rSize, aOutMapMode ).Height() ) );
//#i69780 clip final tile size to a sane max size
while ((static_cast<sal_Int64>(rSize.Width()) * nTileCacheSize1D) > SAL_MAX_UINT16)
@@ -536,12 +536,12 @@ void GraphicObject::DrawTiled( OutputDevice* pOut, const tools::Rectangle& rArea
while ((static_cast<sal_Int64>(rSize.Height()) * nTileCacheSize1D) > SAL_MAX_UINT16)
nTileCacheSize1D /= 2;
- ImplDrawTiled( pOut, rArea, aOutTileSize, rOffset, nullptr, nTileCacheSize1D );
+ ImplDrawTiled(rOut, rArea, aOutTileSize, rOffset, nullptr, nTileCacheSize1D);
}
-bool GraphicObject::StartAnimation( OutputDevice* pOut, const Point& rPt, const Size& rSz,
- tools::Long nExtraData,
- OutputDevice* pFirstFrameOutDev )
+bool GraphicObject::StartAnimation(OutputDevice& rOut, const Point& rPt, const Size& rSz,
+ tools::Long nExtraData,
+ OutputDevice* pFirstFrameOutDev)
{
bool bRet = false;
@@ -559,16 +559,16 @@ bool GraphicObject::StartAnimation( OutputDevice* pOut, const Point& rPt, const
{
tools::PolyPolygon aClipPolyPoly;
bool bRectClip;
- const bool bCrop = ImplGetCropParams( pOut, aPt, aSz, &aAttr, aClipPolyPoly, bRectClip );
+ const bool bCrop = ImplGetCropParams(rOut, aPt, aSz, &aAttr, aClipPolyPoly, bRectClip);
- pOut->Push( PushFlags::CLIPREGION );
+ rOut.Push(PushFlags::CLIPREGION);
if( bCrop )
{
if( bRectClip )
- pOut->IntersectClipRegion( aClipPolyPoly.GetBoundRect() );
+ rOut.IntersectClipRegion(aClipPolyPoly.GetBoundRect());
else
- pOut->IntersectClipRegion(vcl::Region(aClipPolyPoly));
+ rOut.IntersectClipRegion(vcl::Region(aClipPolyPoly));
}
}
@@ -578,15 +578,15 @@ bool GraphicObject::StartAnimation( OutputDevice* pOut, const Point& rPt, const
mxSimpleCache->maGraphic.SetAnimationNotifyHdl(GetGraphic().GetAnimationNotifyHdl());
}
- mxSimpleCache->maGraphic.StartAnimation(pOut, aPt, aSz, nExtraData, pFirstFrameOutDev);
+ mxSimpleCache->maGraphic.StartAnimation(rOut, aPt, aSz, nExtraData, pFirstFrameOutDev);
if( bCropped )
- pOut->Pop();
+ rOut.Pop();
bRet = true;
}
else
- bRet = Draw( pOut, rPt, rSz, &aAttr );
+ bRet = Draw(rOut, rPt, rSz, &aAttr);
return bRet;
}
diff --git a/vcl/source/graphic/GraphicObject2.cxx b/vcl/source/graphic/GraphicObject2.cxx
index e5b994f72b83..b19fc5e10f02 100644
--- a/vcl/source/graphic/GraphicObject2.cxx
+++ b/vcl/source/graphic/GraphicObject2.cxx
@@ -169,7 +169,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
Point aCurrPos(aTileInfo.aNextTileTopLeft.X(), aTileInfo.aTileTopLeft.Y());
for (int nX=0; nX < aTileInfo.nTilesEmptyX; nX += nMSBFactor)
{
- if (!pTileGraphic->Draw(&rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr))
+ if (!pTileGraphic->Draw(rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr))
return false;
aCurrPos.AdjustX(aTileInfo.aTileSizePixel.Width() );
@@ -190,7 +190,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
aCurrPos.setY( aTileInfo.aNextTileTopLeft.Y() );
for (int nY=0; nY < aTileInfo.nTilesEmptyY; nY += nMSBFactor)
{
- if (!pTileGraphic->Draw(&rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr))
+ if (!pTileGraphic->Draw(rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr))
return false;
aCurrPos.AdjustY(aTileInfo.aTileSizePixel.Height() );
@@ -250,7 +250,7 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
{
if( bNoFirstTileDraw )
bNoFirstTileDraw = false; // don't draw first tile position
- else if (!pTileGraphic->Draw(&rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr))
+ else if (!pTileGraphic->Draw(rVDev, aCurrPos, aTileInfo.aTileSizePixel, pAttr))
return false;
aCurrPos.AdjustX(aTileInfo.aTileSizePixel.Width() );
@@ -272,10 +272,10 @@ bool GraphicObject::ImplRenderTileRecursive( VirtualDevice& rVDev, int nExponent
return true;
}
-bool GraphicObject::ImplDrawTiled( OutputDevice* pOut, const tools::Rectangle& rArea, const Size& rSizePixel,
- const Size& rOffset, const GraphicAttr* pAttr, int nTileCacheSize1D )
+bool GraphicObject::ImplDrawTiled(OutputDevice& rOut, const tools::Rectangle& rArea, const Size& rSizePixel,
+ const Size& rOffset, const GraphicAttr* pAttr, int nTileCacheSize1D)
{
- const MapMode aOutMapMode( pOut->GetMapMode() );
+ const MapMode aOutMapMode(rOut.GetMapMode());
const MapMode aMapMode( aOutMapMode.GetMapUnit(), Point(), aOutMapMode.GetScaleX(), aOutMapMode.GetScaleY() );
bool bRet( false );
@@ -327,15 +327,15 @@ bool GraphicObject::ImplDrawTiled( OutputDevice* pOut, const tools::Rectangle& r
// paint generated tile
GraphicObject aTmpGraphic( aTileBitmap );
- bRet = aTmpGraphic.ImplDrawTiled( pOut, rArea,
- aTileBitmap.GetSizePixel(),
- rOffset, pAttr, nTileCacheSize1D );
+ bRet = aTmpGraphic.ImplDrawTiled(rOut, rArea,
+ aTileBitmap.GetSizePixel(),
+ rOffset, pAttr, nTileCacheSize1D);
}
}
else
{
- const Size aOutOffset( pOut->LogicToPixel( rOffset, aOutMapMode ) );
- const tools::Rectangle aOutArea( pOut->LogicToPixel( rArea, aOutMapMode ) );
+ const Size aOutOffset( rOut.LogicToPixel( rOffset, aOutMapMode ) );
+ const tools::Rectangle aOutArea( rOut.LogicToPixel( rArea, aOutMapMode ) );
// number of invisible (because out-of-area) tiles
int nInvisibleTilesX;
@@ -354,24 +354,24 @@ bool GraphicObject::ImplDrawTiled( OutputDevice* pOut, const tools::Rectangle& r
nInvisibleTilesY = aOutOffset.Height() / rSizePixel.Height();
// origin from where to 'virtually' start drawing in pixel
- const Point aOutOrigin( pOut->LogicToPixel( Point( rArea.Left() - rOffset.Width(),
+ const Point aOutOrigin( rOut.LogicToPixel( Point( rArea.Left() - rOffset.Width(),
rArea.Top() - rOffset.Height() ) ) );
// position in pixel from where to really start output
const Point aOutStart( aOutOrigin.X() + nInvisibleTilesX*rSizePixel.Width(),
aOutOrigin.Y() + nInvisibleTilesY*rSizePixel.Height() );
- pOut->Push( PushFlags::CLIPREGION );
- pOut->IntersectClipRegion( rArea );
+ rOut.Push( PushFlags::CLIPREGION );
+ rOut.IntersectClipRegion( rArea );
// Paint all tiles
- bRet = ImplDrawTiled( *pOut, aOutStart,
- (aOutArea.GetWidth() + aOutArea.Left() - aOutStart.X() + rSizePixel.Width() - 1) / rSizePixel.Width(),
- (aOutArea.GetHeight() + aOutArea.Top() - aOutStart.Y() + rSizePixel.Height() - 1) / rSizePixel.Height(),
- rSizePixel, pAttr );
+ bRet = ImplDrawTiled(rOut, aOutStart,
+ (aOutArea.GetWidth() + aOutArea.Left() - aOutStart.X() + rSizePixel.Width() - 1) / rSizePixel.Width(),
+ (aOutArea.GetHeight() + aOutArea.Top() - aOutStart.Y() + rSizePixel.Height() - 1) / rSizePixel.Height(),
+ rSizePixel, pAttr);
- pOut->Pop();
+ rOut.Pop();
}
return bRet;
@@ -408,10 +408,10 @@ bool GraphicObject::ImplDrawTiled( OutputDevice& rOut, const Point& rPosPixel,
// update return value. This method should return true, if
// at least one of the looped Draws succeeded.
- bRet |= Draw( &rOut,
- bDrawInPixel ? aCurrPos : rOut.PixelToLogic( aCurrPos ),
- bDrawInPixel ? rTileSizePixel : aTileSizeLogic,
- pAttr );
+ bRet |= Draw(rOut,
+ bDrawInPixel ? aCurrPos : rOut.PixelToLogic(aCurrPos),
+ bDrawInPixel ? rTileSizePixel : aTileSizeLogic,
+ pAttr);
aCurrPos.AdjustX(rTileSizePixel.Width() );
}