include/vcl/vectorgraphicdata.hxx | 1 - sfx2/source/appl/appmisc.cxx | 11 ++++++++++- vcl/source/gdi/vectorgraphicdata.cxx | 28 +--------------------------- 3 files changed, 11 insertions(+), 29 deletions(-)
New commits: commit 4e6053bededfdec658a9081142f348a784bdce9e Author: Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk> AuthorDate: Sat Jan 25 20:53:18 2025 +0900 Commit: David Gilbert <freedesk...@treblig.org> CommitDate: Sun Feb 9 17:51:38 2025 +0100 vcl: remove VectorGraphicData string path constructor Not needing that convenience that is used only once - better to be sure we always take the BinaryDataContainer as a input. This also means every VectorGraphicData still has access to the source format (SVG, PDF, EMF,...). Change-Id: I179f6eafd2fbb18497e433a1c5d3f4dcc551c508 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/180787 Tested-by: Jenkins Reviewed-by: David Gilbert <freedesk...@treblig.org> diff --git a/include/vcl/vectorgraphicdata.hxx b/include/vcl/vectorgraphicdata.hxx index c10b068e384a..a7f484c7e7bf 100644 --- a/include/vcl/vectorgraphicdata.hxx +++ b/include/vcl/vectorgraphicdata.hxx @@ -81,7 +81,6 @@ private: VectorGraphicData& operator=(const VectorGraphicData&) = delete; public: - VectorGraphicData(const OUString& rPath, VectorGraphicDataType eVectorDataType); VectorGraphicData( BinaryDataContainer aDataContainer, VectorGraphicDataType eVectorDataType, diff --git a/sfx2/source/appl/appmisc.cxx b/sfx2/source/appl/appmisc.cxx index 0e84d5d1e90d..d96568b825a5 100644 --- a/sfx2/source/appl/appmisc.cxx +++ b/sfx2/source/appl/appmisc.cxx @@ -138,7 +138,16 @@ bool SfxApplication::loadBrandSvg(const char *pName, BitmapEx &rBitmap, int nWid if ( !FileExists(aObj) ) return false; - VectorGraphicData aVectorGraphicData(aObj.PathToFileName(), VectorGraphicDataType::Svg); + // Read the SVG file + SvFileStream aStream(aObj.PathToFileName(), StreamMode::STD_READ); + if (aStream.GetError()) + return false; + + BinaryDataContainer aDataContainer(aStream, aStream.remainingSize()); + if (aStream.GetError()) + return false; + + VectorGraphicData aVectorGraphicData(aDataContainer, VectorGraphicDataType::Svg); // transform into [0,0,width,width*aspect] std dimensions diff --git a/vcl/source/gdi/vectorgraphicdata.cxx b/vcl/source/gdi/vectorgraphicdata.cxx index 953c0b66c822..68245fe25acd 100644 --- a/vcl/source/gdi/vectorgraphicdata.cxx +++ b/vcl/source/gdi/vectorgraphicdata.cxx @@ -319,10 +319,7 @@ std::pair<VectorGraphicData::State, size_t> VectorGraphicData::getSizeBytes() co } } -VectorGraphicData::VectorGraphicData( - BinaryDataContainer aDataContainer, - VectorGraphicDataType eVectorDataType, - sal_Int32 nPageIndex) +VectorGraphicData::VectorGraphicData(BinaryDataContainer aDataContainer, VectorGraphicDataType eVectorDataType, sal_Int32 nPageIndex) : maDataContainer(std::move(aDataContainer)), mbSequenceCreated(false), mNestedBitmapSize(0), @@ -331,29 +328,6 @@ VectorGraphicData::VectorGraphicData( { } -VectorGraphicData::VectorGraphicData( - const OUString& rPath, - VectorGraphicDataType eVectorDataType) -: mbSequenceCreated(false), - mNestedBitmapSize(0), - meType(eVectorDataType), - mnPageIndex(-1) -{ - SvFileStream rIStm(rPath, StreamMode::STD_READ); - if(rIStm.GetError()) - return; - const sal_uInt32 nStmLen(rIStm.remainingSize()); - if (nStmLen) - { - BinaryDataContainer aData(rIStm, nStmLen); - - if (!rIStm.GetError()) - { - maDataContainer = std::move(aData); - } - } -} - VectorGraphicData::~VectorGraphicData() { }