vcl/inc/impgraph.hxx | 3 +-- vcl/source/gdi/graph.cxx | 6 ++---- vcl/source/gdi/impgraph.cxx | 13 ++++--------- 3 files changed, 7 insertions(+), 15 deletions(-)
New commits: commit e83f7b7c84d5345879c5543b78ce6ad2b32dc2bc Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sun Mar 17 23:23:41 2024 +0900 Commit: Tomaž Vajngerl <qui...@gmail.com> CommitDate: Sat Mar 23 03:06:18 2024 +0100 vcl: set "default" type only thorugh a ImpGraphic constructor and do some more clean-up. Change-Id: I28c33887226444046d21076118fd066eb3a231d3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/164947 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <qui...@gmail.com> diff --git a/vcl/inc/impgraph.hxx b/vcl/inc/impgraph.hxx index 9ef10d19061d..707810b9de2e 100644 --- a/vcl/inc/impgraph.hxx +++ b/vcl/inc/impgraph.hxx @@ -89,7 +89,7 @@ private: bool mbPrepared = false; public: - ImpGraphic(); + ImpGraphic(bool bDefault = false); ImpGraphic( const ImpGraphic& rImpGraphic ); ImpGraphic( ImpGraphic&& rImpGraphic ) noexcept; ImpGraphic( GraphicExternalLink aExternalLink); @@ -133,7 +133,6 @@ private: void clear(); GraphicType getType() const { return meType;} - void setDefaultType(); bool isSupportedGraphic() const; bool isTransparent() const; diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx index 4c0efa56beba..252ee189b892 100644 --- a/vcl/source/gdi/graph.cxx +++ b/vcl/source/gdi/graph.cxx @@ -287,8 +287,7 @@ bool Graphic::IsNone() const void Graphic::Clear() { - ImplTestRefCount(); - mxImpGraphic->clear(); + mxImpGraphic = std::make_shared<ImpGraphic>(); } GraphicType Graphic::GetType() const @@ -298,8 +297,7 @@ GraphicType Graphic::GetType() const void Graphic::SetDefaultType() { - ImplTestRefCount(); - mxImpGraphic->setDefaultType(); + mxImpGraphic = std::make_shared<ImpGraphic>(true); } bool Graphic::IsSupportedGraphic() const diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 2c9f03f3a02e..ceb6c111cf7b 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -81,7 +81,8 @@ SvStream* ImpGraphic::getSwapFileStream() const return nullptr; } -ImpGraphic::ImpGraphic() +ImpGraphic::ImpGraphic(bool bDefault) + : meType(bDefault ? GraphicType::Default : GraphicType::NONE) { } @@ -149,7 +150,7 @@ ImpGraphic::ImpGraphic(GraphicExternalLink aGraphicExternalLink) ImpGraphic::ImpGraphic(const BitmapEx& rBitmapEx) : maBitmapEx(rBitmapEx) - , meType(!rBitmapEx.IsEmpty() ? GraphicType::Bitmap : GraphicType::NONE) + , meType(rBitmapEx.IsEmpty() ? GraphicType::NONE : GraphicType::Bitmap) { } @@ -408,15 +409,9 @@ void ImpGraphic::clear() maGraphicExternalLink.msURL.clear(); } -void ImpGraphic::setDefaultType() -{ - clear(); - meType = GraphicType::Default; -} - bool ImpGraphic::isSupportedGraphic() const { - return( meType != GraphicType::NONE ); + return meType != GraphicType::NONE; } bool ImpGraphic::isTransparent() const