From c7483d48df1b9ae70335346846d02a4fc53b4558 Mon Sep 17 00:00:00 2001 From: Noel Date: Fri, 26 Mar 2021 16:15:11 +0200 Subject: drop operator bool and operator! from Bitmap and BitmapEx IRC chat: noelgrandin: doesn't adding operator bool to Bitmap has the same problem as Graphic and the reason why you dropped that commit 7334034ae93b49fc93b5859a3c047a319d138282 "drop Graphic::operator bool" quikee[m], hmmm, good point maybe I should just drop both operator bool and operator! in favor of IsEmpty noelgrandin: I don't remember what the problem is I just remembered we dropped it Graphic :) sure, dropping everything for IsEmpty is probably the best Change-Id: Ieae289cda64f0b8d8fdecd5ea9e6f2bb874ff4cd Reviewed-on: https://gerrit.libreoffice.org/c/core/+/113163 Tested-by: Jenkins Reviewed-by: Noel Grandin --- vcl/source/gdi/FileDefinitionWidgetDraw.cxx | 4 ++-- vcl/source/gdi/graph.cxx | 2 +- vcl/source/gdi/impgraph.cxx | 6 +++--- vcl/source/gdi/metaact.cxx | 18 +++++++++--------- vcl/source/gdi/pdfwriter_impl.cxx | 6 +++--- vcl/source/gdi/wall.cxx | 2 +- 6 files changed, 19 insertions(+), 19 deletions(-) (limited to 'vcl/source/gdi') diff --git a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx index f90e992963cc..4a8f8bd8d953 100644 --- a/vcl/source/gdi/FileDefinitionWidgetDraw.cxx +++ b/vcl/source/gdi/FileDefinitionWidgetDraw.cxx @@ -475,7 +475,7 @@ void munchDrawCommands(std::vector> const& rDr SvFileStream aFileStream(rWidgetDraw.msSource, StreamMode::READ); vcl::bitmap::loadFromSvg(aFileStream, "", aBitmap, nScaleFactor); - if (!!aBitmap) + if (!aBitmap.IsEmpty()) { rCacheImages.insert(std::make_pair(rCacheKey, aBitmap)); } @@ -489,7 +489,7 @@ void munchDrawCommands(std::vector> const& rDr tools::Long nImageHeight = aBitmap.GetSizePixel().Height(); SalTwoRect aTR(0, 0, nImageWidth, nImageHeight, nX, nY, nImageWidth / nScaleFactor, nImageHeight / nScaleFactor); - if (!!aBitmap) + if (!aBitmap.IsEmpty()) { const std::shared_ptr pSalBitmap = aBitmap.GetBitmap().ImplGetSalBitmap(); diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index b4b934ee2f49..df961fba47f2 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -57,7 +57,7 @@ void ImplDrawDefault( OutputDevice* pOutDev, const OUString* pText, aSize.AdjustWidth( -(2*nPixelWidth + 4*nPixel) ); aSize.AdjustHeight( -(2*nPixelWidth + 4*nPixel) ); - if( !aSize.IsEmpty() && pBitmapEx && !!*pBitmapEx ) + if( !aSize.IsEmpty() && pBitmapEx && !pBitmapEx->IsEmpty() ) { Size aBitmapSize( pOutDev->PixelToLogic( pBitmapEx->GetSizePixel() ) ); diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index e16e12b0ef5b..b06423adbe3e 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -629,7 +629,7 @@ Bitmap ImpGraphic::getBitmap(const GraphicConversionParameters& rParameters) con aRetBmp = maBitmapEx.GetBitmap(); } - if( !!aRetBmp ) + if( !aRetBmp.IsEmpty() ) { aRetBmp.SetPrefMapMode(getPrefMapMode()); aRetBmp.SetPrefSize(getPrefSize()); @@ -733,7 +733,7 @@ const GDIMetaFile& ImpGraphic::getGDIMetaFile() const // survive copying (change this if not wanted) ImpGraphic* pThat = const_cast< ImpGraphic* >(this); - if(maVectorGraphicData && !maBitmapEx) + if(maVectorGraphicData && maBitmapEx.IsEmpty()) { // use maBitmapEx as local buffer for rendered svg pThat->maBitmapEx = getVectorGraphicReplacement(); @@ -1012,7 +1012,7 @@ void ImpGraphic::draw(OutputDevice* pOutDev, const Point& rDestPt) const { case GraphicType::Bitmap: { - if (maVectorGraphicData && !maBitmapEx) + if (maVectorGraphicData && maBitmapEx.IsEmpty()) { // use maBitmapEx as local buffer for rendered svg const_cast(this)->maBitmapEx = getVectorGraphicReplacement(); diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index 871c646a02e0..02fce9554f14 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -1498,7 +1498,7 @@ void MetaBmpAction::Scale( double fScaleX, double fScaleY ) void MetaBmpAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { - if( !!maBmp ) + if( !maBmp.IsEmpty() ) { MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); @@ -1556,7 +1556,7 @@ void MetaBmpScaleAction::Scale( double fScaleX, double fScaleY ) void MetaBmpScaleAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { - if( !!maBmp ) + if( !maBmp.IsEmpty() ) { MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); @@ -1620,7 +1620,7 @@ void MetaBmpScalePartAction::Scale( double fScaleX, double fScaleY ) void MetaBmpScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { - if( !!maBmp ) + if( !maBmp.IsEmpty() ) { MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); @@ -1680,7 +1680,7 @@ void MetaBmpExAction::Scale( double fScaleX, double fScaleY ) void MetaBmpExAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { - if( maBmpEx.GetBitmap() ) + if( !maBmpEx.GetBitmap().IsEmpty() ) { MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); @@ -1738,7 +1738,7 @@ void MetaBmpExScaleAction::Scale( double fScaleX, double fScaleY ) void MetaBmpExScaleAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { - if( maBmpEx.GetBitmap() ) + if( !maBmpEx.GetBitmap().IsEmpty() ) { MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); @@ -1801,7 +1801,7 @@ void MetaBmpExScalePartAction::Scale( double fScaleX, double fScaleY ) void MetaBmpExScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { - if( maBmpEx.GetBitmap() ) + if( !maBmpEx.GetBitmap().IsEmpty() ) { MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); @@ -1863,7 +1863,7 @@ void MetaMaskAction::Scale( double fScaleX, double fScaleY ) void MetaMaskAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { - if( !!maBmp ) + if( !maBmp.IsEmpty() ) { MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); @@ -1923,7 +1923,7 @@ void MetaMaskScaleAction::Scale( double fScaleX, double fScaleY ) void MetaMaskScaleAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { - if( !!maBmp ) + if( !maBmp.IsEmpty() ) { MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); @@ -1988,7 +1988,7 @@ void MetaMaskScalePartAction::Scale( double fScaleX, double fScaleY ) void MetaMaskScalePartAction::Write( SvStream& rOStm, ImplMetaWriteData* pData ) { - if( !!maBmp ) + if( !maBmp.IsEmpty() ) { MetaAction::Write(rOStm, pData); VersionCompatWrite aCompat(rOStm, 1); diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index b81843b459e4..365204314733 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -8368,7 +8368,7 @@ void PDFWriterImpl::writeJPG( JPGEmit& rObject ) rObject.m_pStream->Seek( STREAM_SEEK_TO_BEGIN ); sal_Int32 nMaskObject = 0; - if( !!rObject.m_aMask ) + if( !rObject.m_aMask.IsEmpty() ) { if( rObject.m_aMask.GetBitCount() == 1 || ( rObject.m_aMask.GetBitCount() == 8 && m_aContext.Version >= PDFWriter::PDFVersion::PDF_1_4 && !m_bIsPDF_A1 ) @@ -9020,7 +9020,7 @@ void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const // load stream to bitmap and draw the bitmap instead Graphic aGraphic; GraphicConverter::Import( rDCTData, aGraphic, ConvertDataFormat::JPG ); - if( !!rMask && rMask.GetSizePixel() == aGraphic.GetSizePixel() ) + if( !rMask.IsEmpty() && rMask.GetSizePixel() == aGraphic.GetSizePixel() ) { Bitmap aBmp( aGraphic.GetBitmapEx().GetBitmap() ); BitmapEx aBmpEx( aBmp, rMask ); @@ -9054,7 +9054,7 @@ void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const rEmit.m_aID = aID; rEmit.m_pStream = std::move( pStream ); rEmit.m_bTrueColor = bIsTrueColor; - if( !! rMask && rMask.GetSizePixel() == rSizePixel ) + if( !rMask.IsEmpty() && rMask.GetSizePixel() == rSizePixel ) rEmit.m_aMask = rMask; createEmbeddedFile(rGraphic, rEmit.m_aReferenceXObject, rEmit.m_nObject); diff --git a/vcl/source/gdi/wall.cxx b/vcl/source/gdi/wall.cxx index db2d0804d747..3fb7acaaff1b 100644 --- a/vcl/source/gdi/wall.cxx +++ b/vcl/source/gdi/wall.cxx @@ -218,7 +218,7 @@ WallpaperStyle Wallpaper::GetStyle() const void Wallpaper::SetBitmap( const BitmapEx& rBitmap ) { - if ( !rBitmap ) + if ( rBitmap.IsEmpty() ) { if ( mpImplWallpaper->mpBitmap ) { -- cgit