clang-tidy: performance-unnecessary-copy-initialization in vcl
Change-Id: Idb09d0d256601fb3b9e822404b2f57f41d04d713 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176443 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Jenkins
This commit is contained in:
parent
e23be78a6a
commit
33c2a79f14
@ -1214,7 +1214,7 @@ bool CairoCommon::drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDevice,
|
||||
// MM01 checked/verified for Cairo
|
||||
for (sal_uInt32 a(0); a < aPolyPolygonLine.count(); a++)
|
||||
{
|
||||
const basegfx::B2DPolygon aPolyLine(aPolyPolygonLine.getB2DPolygon(a));
|
||||
const basegfx::B2DPolygon& aPolyLine(aPolyPolygonLine.getB2DPolygon(a));
|
||||
|
||||
if (!bNoJoin)
|
||||
{
|
||||
|
@ -386,7 +386,7 @@ void SAL_CALL QtFilePicker::appendFilterGroup(const OUString& rGroupTitle,
|
||||
const sal_uInt16 length = filters.getLength();
|
||||
for (sal_uInt16 i = 0; i < length; ++i)
|
||||
{
|
||||
beans::StringPair aPair = filters[i];
|
||||
const beans::StringPair& aPair = filters[i];
|
||||
appendFilter(aPair.First, aPair.Second);
|
||||
}
|
||||
}
|
||||
|
@ -383,7 +383,7 @@ bool QtGraphicsBackend::drawPolyLine(const basegfx::B2DHomMatrix& rObjectToDevic
|
||||
// but this NEEDS to be checked/verified
|
||||
for (sal_uInt32 a(0); a < aPolyPolygonLine.count(); a++)
|
||||
{
|
||||
const basegfx::B2DPolygon aPolyLine(aPolyPolygonLine.getB2DPolygon(a));
|
||||
const basegfx::B2DPolygon& aPolyLine(aPolyPolygonLine.getB2DPolygon(a));
|
||||
AddPolygonToPath(aPath, aPolyLine, aPolyLine.isClosed(), !getAntiAlias(), true);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ BitmapEx BitmapDisabledImageFilter::execute(BitmapEx const& rBitmapEx) const
|
||||
Bitmap aGrey(aSize, ePixelFormat, pPal);
|
||||
BitmapScopedWriteAccess pGrey(aGrey);
|
||||
|
||||
Bitmap aReadBitmap(rBitmapEx.GetBitmap());
|
||||
const Bitmap& aReadBitmap(rBitmapEx.GetBitmap());
|
||||
BitmapScopedReadAccess pRead(aReadBitmap);
|
||||
if (pRead && pGrey)
|
||||
{
|
||||
|
@ -603,7 +603,7 @@ BitmapFilterStackBlur::~BitmapFilterStackBlur() {}
|
||||
|
||||
BitmapEx BitmapFilterStackBlur::execute(BitmapEx const& rBitmapEx) const
|
||||
{
|
||||
Bitmap aBitmap = rBitmapEx.GetBitmap();
|
||||
const Bitmap& aBitmap = rBitmapEx.GetBitmap();
|
||||
Bitmap result = filter(aBitmap);
|
||||
return BitmapEx(result, rBitmapEx.GetAlphaMask());
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ BitmapEx BitmapLightenFilter::execute(BitmapEx const& rBitmapEx) const
|
||||
{
|
||||
const Size aSize(rBitmapEx.GetSizePixel());
|
||||
|
||||
Bitmap aBitmap(rBitmapEx.GetBitmap());
|
||||
const Bitmap& aBitmap(rBitmapEx.GetBitmap());
|
||||
Bitmap aDarkBitmap(aSize, vcl::PixelFormat::N24_BPP);
|
||||
|
||||
BitmapScopedReadAccess pRead(aBitmap);
|
||||
|
@ -20,7 +20,7 @@ BitmapEx BitmapMaskToAlphaFilter::execute(BitmapEx const& rBitmapEx) const
|
||||
{
|
||||
const Size aSize(rBitmapEx.GetSizePixel());
|
||||
|
||||
Bitmap aBitmap(rBitmapEx.GetBitmap());
|
||||
const Bitmap& aBitmap(rBitmapEx.GetBitmap());
|
||||
Bitmap aOutBitmap(aSize, vcl::PixelFormat::N8_BPP, &Bitmap::GetGreyPalette(256));
|
||||
|
||||
BitmapScopedReadAccess pRead(aBitmap);
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
BitmapEx BitmapShadowFilter::execute(BitmapEx const& rBitmapEx) const
|
||||
{
|
||||
BitmapEx aBitmapEx(rBitmapEx);
|
||||
const BitmapEx& aBitmapEx(rBitmapEx);
|
||||
BitmapScopedWriteAccess pWriteAccess(const_cast<Bitmap&>(aBitmapEx.GetBitmap()));
|
||||
|
||||
if (!pWriteAccess)
|
||||
|
@ -289,8 +289,8 @@ BitmapEx CreateFromData( RawBitmap&& rawBitmap )
|
||||
|
||||
void fillWithData(sal_uInt8* pData, BitmapEx const& rBitmapEx)
|
||||
{
|
||||
Bitmap aBitmap = rBitmapEx.GetBitmap();
|
||||
AlphaMask aAlphaMask = rBitmapEx.GetAlphaMask();
|
||||
const Bitmap& aBitmap = rBitmapEx.GetBitmap();
|
||||
const AlphaMask& aAlphaMask = rBitmapEx.GetAlphaMask();
|
||||
BitmapScopedReadAccess aReadAccessBitmap(aBitmap);
|
||||
BitmapScopedReadAccess aReadAccessAlpha(aAlphaMask);
|
||||
|
||||
@ -413,7 +413,7 @@ BitmapEx CanvasTransformBitmap( const BitmapEx& rBitmap,
|
||||
return BitmapEx();
|
||||
|
||||
const Size aBmpSize( rBitmap.GetSizePixel() );
|
||||
Bitmap aSrcBitmap( rBitmap.GetBitmap() );
|
||||
const Bitmap& aSrcBitmap( rBitmap.GetBitmap() );
|
||||
Bitmap aSrcAlpha;
|
||||
|
||||
// differentiate mask and alpha channel (on-off
|
||||
@ -731,7 +731,7 @@ static bool readAlpha( BitmapReadAccess const * pAlphaReadAcc, tools::Long nY, c
|
||||
**/
|
||||
void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, unsigned char*& data, bool& bHasAlpha, tools::Long& rnWidth, tools::Long& rnHeight )
|
||||
{
|
||||
AlphaMask aAlpha = aBmpEx.GetAlphaMask();
|
||||
const AlphaMask& aAlpha = aBmpEx.GetAlphaMask();
|
||||
|
||||
BitmapScopedReadAccess pBitmapReadAcc( aBitmap );
|
||||
BitmapScopedReadAccess pAlphaReadAcc;
|
||||
@ -1022,7 +1022,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un
|
||||
|
||||
uno::Sequence< sal_Int8 > CanvasExtractBitmapData(BitmapEx const & rBitmapEx, const geometry::IntegerRectangle2D& rect)
|
||||
{
|
||||
Bitmap aBitmap( rBitmapEx.GetBitmap() );
|
||||
const Bitmap& aBitmap( rBitmapEx.GetBitmap() );
|
||||
Bitmap aAlpha( rBitmapEx.GetAlphaMask().GetBitmap() );
|
||||
|
||||
BitmapScopedReadAccess pReadAccess( aBitmap );
|
||||
@ -1107,7 +1107,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un
|
||||
|
||||
if(!rBitmapEx.IsAlpha())
|
||||
{
|
||||
Bitmap aBitmap(rBitmapEx.GetBitmap());
|
||||
const Bitmap& aBitmap(rBitmapEx.GetBitmap());
|
||||
|
||||
if(8 == aBitmap.GetSizePixel().Width() && 8 == aBitmap.GetSizePixel().Height())
|
||||
{
|
||||
@ -1220,7 +1220,7 @@ void CanvasCairoExtractBitmapData( BitmapEx const & aBmpEx, Bitmap & aBitmap, un
|
||||
|
||||
bool convertBitmap32To24Plus8(BitmapEx const & rInput, BitmapEx & rResult)
|
||||
{
|
||||
Bitmap aBitmap(rInput.GetBitmap());
|
||||
const Bitmap& aBitmap(rInput.GetBitmap());
|
||||
if (aBitmap.getPixelFormat() != vcl::PixelFormat::N32_BPP)
|
||||
return false;
|
||||
|
||||
|
@ -819,7 +819,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
|
||||
Bitmap aBitmap( aBitmapEx.GetBitmap() );
|
||||
if ( mbGrayScale )
|
||||
aBitmap.Convert( BmpConversion::N8BitGreys );
|
||||
AlphaMask aMask( aBitmapEx.GetAlphaMask() );
|
||||
const AlphaMask& aMask( aBitmapEx.GetAlphaMask() );
|
||||
Point aPoint( static_cast<const MetaBmpExAction*>(pMA)->GetPoint() );
|
||||
Size aSize( rVDev.PixelToLogic( aBitmap.GetSizePixel() ) );
|
||||
ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() );
|
||||
@ -832,7 +832,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
|
||||
Bitmap aBitmap( aBitmapEx.GetBitmap() );
|
||||
if ( mbGrayScale )
|
||||
aBitmap.Convert( BmpConversion::N8BitGreys );
|
||||
AlphaMask aMask( aBitmapEx.GetAlphaMask() );
|
||||
const AlphaMask& aMask( aBitmapEx.GetAlphaMask() );
|
||||
Point aPoint = static_cast<const MetaBmpExScaleAction*>(pMA)->GetPoint();
|
||||
Size aSize( static_cast<const MetaBmpExScaleAction*>(pMA)->GetSize() );
|
||||
ImplBmp( &aBitmap, &aMask, aPoint, aSize.Width(), aSize.Height() );
|
||||
@ -898,7 +898,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
|
||||
if ( aWallpaper.IsBitmap() )
|
||||
{
|
||||
BitmapEx aBitmapEx = aWallpaper.GetBitmap();
|
||||
Bitmap aBitmap( aBitmapEx.GetBitmap() );
|
||||
const Bitmap& aBitmap( aBitmapEx.GetBitmap() );
|
||||
if ( aBitmapEx.IsAlpha() )
|
||||
{
|
||||
if ( aWallpaper.IsGradient() )
|
||||
@ -907,7 +907,7 @@ void PSWriter::ImplWriteActions( const GDIMetaFile& rMtf, VirtualDevice& rVDev )
|
||||
// gradient action
|
||||
|
||||
}
|
||||
AlphaMask aMask( aBitmapEx.GetAlphaMask() );
|
||||
const AlphaMask& aMask( aBitmapEx.GetAlphaMask() );
|
||||
ImplBmp( &aBitmap, &aMask, Point( aRect.Left(), aRect.Top() ), aRect.GetWidth(), aRect.GetHeight() );
|
||||
}
|
||||
else
|
||||
|
@ -1545,7 +1545,7 @@ ErrCode GraphicFilter::ExportGraphic( const Graphic& rGraphic, std::u16string_vi
|
||||
rOStm.SetVersion( nVersion );
|
||||
|
||||
// #i119735# just use GetGDIMetaFile, it will create a buffered version of contained bitmap now automatically
|
||||
GDIMetaFile aMTF(aGraphic.GetGDIMetaFile());
|
||||
const GDIMetaFile& aMTF(aGraphic.GetGDIMetaFile());
|
||||
|
||||
SvmWriter aWriter( rOStm );
|
||||
aWriter.Write( aMTF );
|
||||
|
@ -1380,7 +1380,7 @@ void SvmWriter::FloatTransparentHandler(const MetaFloatTransparentAction* pActio
|
||||
VersionCompatWrite aCompat(mrStream, bSVG ? 2 : 1);
|
||||
|
||||
SvmWriter aWriter(mrStream);
|
||||
GDIMetaFile aMtf = pAction->GetGDIMetaFile();
|
||||
const GDIMetaFile& aMtf = pAction->GetGDIMetaFile();
|
||||
aWriter.Write(aMtf);
|
||||
TypeSerializer aSerializer(mrStream);
|
||||
aSerializer.writePoint(pAction->GetPoint());
|
||||
@ -1415,7 +1415,7 @@ void SvmWriter::EPSHandler(const MetaEPSAction* pAction)
|
||||
aSerializer.writeSize(pAction->GetSize());
|
||||
|
||||
SvmWriter aWriter(mrStream);
|
||||
GDIMetaFile aMtf = pAction->GetSubstitute();
|
||||
const GDIMetaFile& aMtf = pAction->GetSubstitute();
|
||||
aWriter.Write(aMtf);
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ static bool writeWebp(SvStream& rStream, const BitmapEx& bitmapEx, bool lossless
|
||||
|
||||
// Apparently libwebp needs the entire image data at once in WebPPicture,
|
||||
// so allocate it and copy there.
|
||||
Bitmap bitmap(bitmapEx.GetBitmap());
|
||||
const Bitmap& bitmap(bitmapEx.GetBitmap());
|
||||
AlphaMask bitmapAlpha;
|
||||
if (bitmapEx.IsAlpha())
|
||||
bitmapAlpha = bitmapEx.GetAlphaMask();
|
||||
|
@ -354,7 +354,7 @@ void TypeSerializer::writeGraphic(const Graphic& rGraphic)
|
||||
|
||||
case GraphicType::Bitmap:
|
||||
{
|
||||
auto pVectorGraphicData = aGraphic.getVectorGraphicData();
|
||||
const auto& pVectorGraphicData = aGraphic.getVectorGraphicData();
|
||||
if (pVectorGraphicData)
|
||||
{
|
||||
// stream out Vector Graphic defining data (length, byte array and evtl. path)
|
||||
|
@ -200,7 +200,7 @@ Graphic::Graphic(const Image& rImage)
|
||||
// FIXME: should really defer the BitmapEx load.
|
||||
: mxImpGraphic(new ImpGraphic(rImage.GetBitmapEx()))
|
||||
{
|
||||
OUString aStock = rImage.GetStock();
|
||||
const OUString& aStock = rImage.GetStock();
|
||||
if (aStock.getLength())
|
||||
mxImpGraphic->setOriginURL("private:graphicrepository/" + aStock);
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ const GDIMetaFile& ImpGraphic::getGDIMetaFile() const
|
||||
if (1 == aSequence.size())
|
||||
{
|
||||
// try to cast to MetafileAccessor implementation
|
||||
const css::uno::Reference< css::graphic::XPrimitive2D > xReference(aSequence[0]);
|
||||
const css::uno::Reference< css::graphic::XPrimitive2D >& xReference(aSequence[0]);
|
||||
auto pUnoPrimitive = static_cast< const drawinglayer::primitive2d::UnoPrimitive2D* >(xReference.get());
|
||||
if (pUnoPrimitive)
|
||||
{
|
||||
|
@ -594,7 +594,7 @@ OString toHexString(const std::vector<unsigned char>& a)
|
||||
|
||||
void writeBitmapContentChecksum(tools::XmlWriter& rWriter, Bitmap const& rBitmap)
|
||||
{
|
||||
Bitmap aBitmap(rBitmap);
|
||||
const Bitmap& aBitmap(rBitmap);
|
||||
|
||||
comphelper::Hash aHashEngine(comphelper::HashType::SHA1);
|
||||
BitmapScopedReadAccess pReadAccess(aBitmap);
|
||||
@ -659,7 +659,7 @@ void MetafileXmlDump::dump(const GDIMetaFile& rMetaFile, SvStream& rStream)
|
||||
|
||||
void MetafileXmlDump::writeXml(const GDIMetaFile& rMetaFile, tools::XmlWriter& rWriter)
|
||||
{
|
||||
MapMode aMtfMapMode = rMetaFile.GetPrefMapMode();
|
||||
const MapMode& aMtfMapMode = rMetaFile.GetPrefMapMode();
|
||||
rWriter.attribute("mapunit", convertMapUnitToString(aMtfMapMode.GetMapUnit()));
|
||||
writePoint(rWriter, aMtfMapMode.GetOrigin());
|
||||
rWriter.attribute("scalex", convertFractionToString(aMtfMapMode.GetScaleX()));
|
||||
|
@ -497,7 +497,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
|
||||
xVDev->EnableMapMode( false );
|
||||
|
||||
AlphaMask aAlpha(xVDev->GetBitmap(Point(), xVDev->GetOutputSizePixel()));
|
||||
AlphaMask aPaintAlpha(aPaint.GetAlphaMask());
|
||||
const AlphaMask& aPaintAlpha(aPaint.GetAlphaMask());
|
||||
// The alpha mask is inverted from what is
|
||||
// expected so invert it again. To test this
|
||||
// code, export to PDF the transparent shapes,
|
||||
|
@ -203,7 +203,7 @@ void Printer::DrawDeviceBitmapEx( const Point& rDestPt, const Size& rDestSize,
|
||||
}
|
||||
else
|
||||
{
|
||||
Bitmap aBmp( rBmpEx.GetBitmap() );
|
||||
const Bitmap& aBmp( rBmpEx.GetBitmap() );
|
||||
ImplPrintTransparent( aBmp, rDestPt, rDestSize, rSrcPtPixel, rSrcSizePixel );
|
||||
}
|
||||
}
|
||||
@ -842,7 +842,7 @@ Printer::Printer( const JobSetup& rJobSetup )
|
||||
{
|
||||
ImplInitData();
|
||||
const ImplJobSetup& rConstData = rJobSetup.ImplGetConstData();
|
||||
OUString aDriver = rConstData.GetDriver();
|
||||
const OUString& aDriver = rConstData.GetDriver();
|
||||
SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( rConstData.GetPrinterName(),
|
||||
&aDriver );
|
||||
if ( pInfo )
|
||||
@ -1086,7 +1086,7 @@ bool Printer::SetPrinterProps( const Printer* pPrinter )
|
||||
}
|
||||
|
||||
// Construct new printer
|
||||
OUString aDriver = pPrinter->GetDriverName();
|
||||
const OUString& aDriver = pPrinter->GetDriverName();
|
||||
SalPrinterQueueInfo* pInfo = ImplGetQueueInfo( pPrinter->GetName(), &aDriver );
|
||||
if ( pInfo )
|
||||
{
|
||||
|
@ -232,7 +232,7 @@ uno::Reference< graphic::XGraphic > SAL_CALL Graphic::applyDuotone(
|
||||
::Graphic aReturnGraphic;
|
||||
|
||||
BitmapEx aBitmapEx( aGraphic.GetBitmapEx() );
|
||||
AlphaMask aMask( aBitmapEx.GetAlphaMask() );
|
||||
const AlphaMask& aMask( aBitmapEx.GetAlphaMask() );
|
||||
|
||||
BitmapEx aTmpBmpEx(aBitmapEx.GetBitmap());
|
||||
BitmapFilter::Filter(aTmpBmpEx,
|
||||
|
@ -55,7 +55,7 @@ void OutputDevice::SetBackground( const Wallpaper& rBackground )
|
||||
}
|
||||
else if( rBackground.IsBitmap())
|
||||
{
|
||||
BitmapEx bitmap = rBackground.GetBitmap();
|
||||
const BitmapEx& bitmap = rBackground.GetBitmap();
|
||||
if( bitmap.IsAlpha())
|
||||
mpAlphaVDev->SetBackground( Wallpaper( BitmapEx( bitmap.GetAlphaMask().GetBitmap() ) ) );
|
||||
else
|
||||
|
@ -663,7 +663,7 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
|
||||
xVDev->EnableMapMode(false);
|
||||
|
||||
AlphaMask aAlpha(xVDev->GetBitmap(aPoint, xVDev->GetOutputSizePixel()));
|
||||
AlphaMask aPaintAlpha(aPaint.GetAlphaMask());
|
||||
const AlphaMask& aPaintAlpha(aPaint.GetAlphaMask());
|
||||
// The alpha mask is inverted from what
|
||||
// is expected so invert it again
|
||||
aAlpha.Invert(); // convert to alpha
|
||||
@ -700,7 +700,7 @@ void OutputDevice::DrawTransparent( const GDIMetaFile& rMtf, const Point& rPos,
|
||||
xVDev->EnableMapMode( false );
|
||||
|
||||
AlphaMask aAlpha(xVDev->GetBitmap(Point(), xVDev->GetOutputSizePixel()));
|
||||
AlphaMask aPaintAlpha(aPaint.GetAlphaMask());
|
||||
const AlphaMask& aPaintAlpha(aPaint.GetAlphaMask());
|
||||
// The alpha mask is inverted from what
|
||||
// is expected so invert it again
|
||||
aAlpha.Invert(); // convert to alpha
|
||||
|
@ -156,7 +156,7 @@ void MergeNotebookBarMenuAddons(Menu* pPopupMenu, sal_Int16 nItemId, const OUStr
|
||||
AddonNotebookBarItem aAddonNotebookBarItem;
|
||||
Image sImage;
|
||||
MenuItemBits nBits = MenuItemBits::ICON;
|
||||
const css::uno::Sequence<css::beans::PropertyValue> pExtension = aExtension[nSecIdx];
|
||||
const css::uno::Sequence<css::beans::PropertyValue>& pExtension = aExtension[nSecIdx];
|
||||
|
||||
GetAddonNotebookBarItem(pExtension, aAddonNotebookBarItem);
|
||||
|
||||
|
@ -966,7 +966,7 @@ sal_Int16 SAL_CALL SalGtkFilePicker::execute()
|
||||
Sequence < OUString > aPathSeq = getFiles();
|
||||
if( aPathSeq.getLength() == 1 )
|
||||
{
|
||||
OUString sFileName = aPathSeq[0];
|
||||
const OUString& sFileName = aPathSeq[0];
|
||||
if (::utl::UCBContentHelper::Exists(sFileName))
|
||||
{
|
||||
INetURLObject aFileObj(sFileName);
|
||||
|
@ -4917,7 +4917,7 @@ namespace
|
||||
{
|
||||
Image aImage(rImage);
|
||||
|
||||
OUString sStock(aImage.GetStock());
|
||||
const OUString& sStock(aImage.GetStock());
|
||||
if (!sStock.isEmpty())
|
||||
return load_icon_by_name(sStock);
|
||||
|
||||
|
@ -1404,7 +1404,7 @@ public:
|
||||
rDev.DrawBitmap(aBelow, aGrey);
|
||||
|
||||
aBelow.Move(aGrey.GetSizePixel().Width(),0);
|
||||
BitmapEx aGreyMask(aSrc);
|
||||
const BitmapEx& aGreyMask(aSrc);
|
||||
rDev.DrawBitmapEx(aBelow, aGreyMask);
|
||||
|
||||
aLocation.Move(aSrc.GetSizePixel().Width()*6,0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user