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 <freedesktop@treblig.org>
This commit is contained in:
Tomaž Vajngerl
2025-01-25 20:53:18 +09:00
committed by David Gilbert
parent 589e523dd9
commit 4e6053bede
3 changed files with 11 additions and 29 deletions

View File

@@ -81,7 +81,6 @@ private:
VectorGraphicData& operator=(const VectorGraphicData&) = delete;
public:
VectorGraphicData(const OUString& rPath, VectorGraphicDataType eVectorDataType);
VectorGraphicData(
BinaryDataContainer aDataContainer,
VectorGraphicDataType eVectorDataType,

View File

@@ -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

View File

@@ -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()
{
}