diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2024-03-17 23:23:41 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2024-03-23 03:06:18 +0100 |
commit | e83f7b7c84d5345879c5543b78ce6ad2b32dc2bc (patch) | |
tree | bac93d795c1fd601ac3f17549e38133ed1bb0a60 /vcl | |
parent | b38974391e8d4bf0d450abfaa86bbccbe1022995 (diff) |
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 <quikee@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/inc/impgraph.hxx | 3 | ||||
-rw-r--r-- | vcl/source/gdi/graph.cxx | 6 | ||||
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 13 |
3 files changed, 7 insertions, 15 deletions
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 |