summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2023-08-30 21:47:41 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2023-09-01 09:54:21 +0200
commit6d8c6e8d60956fd36094035a526c1a29a902204b (patch)
tree6971088b0e1d46b6bbd9581100dd3b7b37fb1934 /vcl
parenta3bd81335c4128cb2f62487868a94882a97eaf66 (diff)
fix ImpGraphic::operator==
This was broken in commit 7b355669c6ddeab2e6cec692d6afdff41c61d0fb Author: Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> Date: Sat Apr 14 15:13:05 2018 +0900 Function to load graphic swapped out (loaded on demand) Change-Id: I8ad120b65da5a7c53e8f90c6e01207f75da11c34 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156310 Tested-by: Noel Grandin <noel.grandin@collabora.co.uk> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/impgraph.cxx79
1 files changed, 37 insertions, 42 deletions
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 41f921228d34..35a2145aa8e4 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -283,61 +283,56 @@ ImpGraphic& ImpGraphic::operator=(ImpGraphic&& rImpGraphic)
return *this;
}
-bool ImpGraphic::operator==( const ImpGraphic& rImpGraphic ) const
+bool ImpGraphic::operator==( const ImpGraphic& rOther ) const
{
- bool bRet = false;
+ if( this == &rOther )
+ return true;
- if( this == &rImpGraphic )
- bRet = true;
- else if (mbPrepared && rImpGraphic.mbPrepared)
- {
- bRet = (*mpGfxLink == *rImpGraphic.mpGfxLink);
- }
- else if (isAvailable() && rImpGraphic.isAvailable())
+ if (mbPrepared && rOther.mbPrepared)
+ return (*mpGfxLink == *rOther.mpGfxLink);
+
+ if (!isAvailable() || !rOther.isAvailable())
+ return false;
+
+ if ( meType != rOther.meType )
+ return false;
+
+ bool bRet = false;
+ switch( meType )
{
- switch( meType )
- {
- case GraphicType::NONE:
- bRet = true;
- break;
+ case GraphicType::NONE:
+ case GraphicType::Default:
+ return true;
- case GraphicType::GdiMetafile:
- {
- if( rImpGraphic.maMetaFile == maMetaFile )
- bRet = true;
- }
- break;
+ case GraphicType::GdiMetafile:
+ return ( rOther.maMetaFile == maMetaFile );
- case GraphicType::Bitmap:
+ case GraphicType::Bitmap:
+ {
+ if(maVectorGraphicData)
{
- if(maVectorGraphicData)
+ if(maVectorGraphicData == rOther.maVectorGraphicData)
{
- if(maVectorGraphicData == rImpGraphic.maVectorGraphicData)
- {
- // equal instances
- bRet = true;
- }
- else if(rImpGraphic.maVectorGraphicData)
- {
- // equal content
- bRet = (*maVectorGraphicData) == (*rImpGraphic.maVectorGraphicData);
- }
+ // equal instances
+ bRet = true;
}
- else if( mpAnimation )
+ else if(rOther.maVectorGraphicData)
{
- if( rImpGraphic.mpAnimation && ( *rImpGraphic.mpAnimation == *mpAnimation ) )
- bRet = true;
+ // equal content
+ bRet = (*maVectorGraphicData) == (*rOther.maVectorGraphicData);
}
- else if( !rImpGraphic.mpAnimation && ( rImpGraphic.maBitmapEx == maBitmapEx ) )
- {
+ }
+ else if( mpAnimation )
+ {
+ if( rOther.mpAnimation && ( *rOther.mpAnimation == *mpAnimation ) )
bRet = true;
- }
}
- break;
-
- case GraphicType::Default:
- break;
+ else if( !rOther.mpAnimation && ( rOther.maBitmapEx == maBitmapEx ) )
+ {
+ bRet = true;
+ }
}
+ break;
}
return bRet;