[Libreoffice-commits] core.git: include/vcl vcl/qa vcl/source
Tomaž Vajngerl (via logerrit)
logerrit at kemper.freedesktop.org
Sat Jan 9 00:09:45 UTC 2021
include/vcl/vectorgraphicdata.hxx | 6 +-----
vcl/qa/cppunit/GraphicTest.cxx | 8 ++++++--
vcl/source/filter/graphicfilter.cxx | 5 ++---
vcl/source/filter/ipdf/pdfread.cxx | 6 +++---
vcl/source/filter/wmf/wmf.cxx | 3 +--
vcl/source/gdi/TypeSerializer.cxx | 7 +++----
vcl/source/gdi/impgraph.cxx | 6 +-----
vcl/source/gdi/vectorgraphicdata.cxx | 7 ++-----
8 files changed, 19 insertions(+), 29 deletions(-)
New commits:
commit 900573fbd77993a48f012b074f498913befbeb26
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.co.uk>
AuthorDate: Sat Dec 26 12:41:08 2020 +0900
Commit: Tomaž Vajngerl <quikee at gmail.com>
CommitDate: Sat Jan 9 01:08:56 2021 +0100
vcl: remove "path" attribute from VectorGraphicData
This isn't used for anything important for the vector graphic
and is mostly empty string anyways.
Change-Id: I1c5b52b5b407bd320cb5053141f1699971607399
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108438
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>
diff --git a/include/vcl/vectorgraphicdata.hxx b/include/vcl/vectorgraphicdata.hxx
index 1787d060e11b..f18def5b7316 100644
--- a/include/vcl/vectorgraphicdata.hxx
+++ b/include/vcl/vectorgraphicdata.hxx
@@ -57,9 +57,6 @@ private:
// the file and length
VectorGraphicDataArray maVectorGraphicDataArray;
- // The absolute Path if available
- OUString maPath;
-
// on demand created content
bool mbSequenceCreated;
basegfx::B2DRange maRange;
@@ -90,7 +87,6 @@ private:
public:
VectorGraphicData(
const VectorGraphicDataArray& rVectorGraphicDataArray,
- const OUString& rPath,
VectorGraphicDataType eVectorDataType,
sal_Int32 nPageIndex = -1);
VectorGraphicData(const OUString& rPath, VectorGraphicDataType eVectorDataType);
@@ -107,7 +103,7 @@ public:
sal_uInt32 getVectorGraphicDataArrayLength() const { return maVectorGraphicDataArray.getLength(); }
enum class State { UNPARSED, PARSED };
std::pair<State, size_t> getSizeBytes() const;
- const OUString& getPath() const { return maPath; }
+
const VectorGraphicDataType& getVectorGraphicDataType() const { return meVectorGraphicDataType; }
/// data read and evtl. on demand creation
diff --git a/vcl/qa/cppunit/GraphicTest.cxx b/vcl/qa/cppunit/GraphicTest.cxx
index c9be978c9f6c..93c9c64ea3d2 100644
--- a/vcl/qa/cppunit/GraphicTest.cxx
+++ b/vcl/qa/cppunit/GraphicTest.cxx
@@ -325,6 +325,10 @@ void GraphicTest::testUnloadedGraphicSizeUnit()
Size aMtfSize100(42, 42);
SvFileStream aStream(aURL, StreamMode::READ);
Graphic aGraphic = rGraphicFilter.ImportUnloadedGraphic(aStream, 0, &aMtfSize100);
+
+ CPPUNIT_ASSERT_EQUAL(Size(42, 42), aGraphic.GetPrefSize());
+
+ // Force it to swap in
aGraphic.makeAvailable();
// Without the accompanying fix in place, this test would have failed with:
@@ -753,10 +757,10 @@ void GraphicTest::testSwappingVectorGraphic_SVG_WithoutGfxLink()
CPPUNIT_ASSERT_EQUAL(true, bool(xStream));
// Check size of the stream
- CPPUNIT_ASSERT_EQUAL(sal_uInt64(249), xStream->remainingSize());
+ CPPUNIT_ASSERT_EQUAL(sal_uInt64(247), xStream->remainingSize());
std::vector<unsigned char> aHash = calculateHash(xStream);
- CPPUNIT_ASSERT_EQUAL(std::string("322da9ea0683f03ce35cf8a71e59b686b9be28e8"),
+ CPPUNIT_ASSERT_EQUAL(std::string("666820973fd95e6cd9e7bc5f1c53732acbc99326"),
toHexString(aHash));
}
diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx
index 635fc88e4627..cd5287f1fe8b 100644
--- a/vcl/source/filter/graphicfilter.cxx
+++ b/vcl/source/filter/graphicfilter.cxx
@@ -1624,7 +1624,7 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
if(!aMemStream.GetError() )
{
- auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aNewData, rPath, VectorGraphicDataType::Svg);
+ auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aNewData, VectorGraphicDataType::Svg);
rGraphic = Graphic(aVectorGraphicDataPtr);
bOkay = true;
}
@@ -1637,7 +1637,7 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
if(!rIStream.GetError())
{
- auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aNewData, rPath, VectorGraphicDataType::Svg);
+ auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aNewData, VectorGraphicDataType::Svg);
rGraphic = Graphic(aVectorGraphicDataPtr);
bOkay = true;
}
@@ -1714,7 +1714,6 @@ ErrCode GraphicFilter::ImportGraphic( Graphic& rGraphic, const OUString& rPath,
auto aVectorGraphicDataPtr =
std::make_shared<VectorGraphicData>(
aNewData,
- rPath,
aDataType);
if (pExtHeader)
diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx
index ecc22331520a..9c8493fcf58c 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -240,8 +240,8 @@ bool importPdfVectorGraphicData(SvStream& rStream,
return false;
}
- rVectorGraphicData = std::make_shared<VectorGraphicData>(aPdfDataArray, OUString(),
- VectorGraphicDataType::Pdf);
+ rVectorGraphicData
+ = std::make_shared<VectorGraphicData>(aPdfDataArray, VectorGraphicDataType::Pdf);
return true;
}
@@ -481,7 +481,7 @@ size_t ImportPDFUnloaded(const OUString& rURL, std::vector<PDFGraphicResult>& rG
tools::Long nPageHeight = convertTwipToMm100(aPageSize.getY() * pointToTwipconversionRatio);
auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(
- aPdfDataArray, OUString(), VectorGraphicDataType::Pdf, nPageIndex);
+ aPdfDataArray, VectorGraphicDataType::Pdf, nPageIndex);
// Create the Graphic with the VectorGraphicDataPtr and link the original PDF stream.
// We swap out this Graphic as soon as possible, and a later swap in
diff --git a/vcl/source/filter/wmf/wmf.cxx b/vcl/source/filter/wmf/wmf.cxx
index 8a04bc1d3025..70ff37f7473f 100644
--- a/vcl/source/filter/wmf/wmf.cxx
+++ b/vcl/source/filter/wmf/wmf.cxx
@@ -54,7 +54,6 @@ bool ReadWindowMetafile( SvStream& rStream, GDIMetaFile& rMTF )
auto aVectorGraphicDataPtr =
std::make_shared<VectorGraphicData>(
aNewData,
- OUString(),
VectorGraphicDataType::Emf);
// create a Graphic and grep Metafile from it
@@ -97,7 +96,7 @@ bool ConvertGraphicToWMF(const Graphic& rGraphic, SvStream& rTargetStream,
uno::Sequence<sal_Int8> aData(reinterpret_cast<const sal_Int8*>(aLink.GetData()),
aLink.GetDataSize());
auto aVectorGraphicData
- = std::make_shared<VectorGraphicData>(aData, OUString(), VectorGraphicDataType::Emf);
+ = std::make_shared<VectorGraphicData>(aData, VectorGraphicDataType::Emf);
aVectorGraphicData->setEnableEMFPlus(false);
Graphic aGraphic(aVectorGraphicData);
bool bRet = ConvertGDIMetaFileToWMF(aGraphic.GetGDIMetaFile(), rTargetStream, pConfigItem,
diff --git a/vcl/source/gdi/TypeSerializer.cxx b/vcl/source/gdi/TypeSerializer.cxx
index e501c58c6be7..114a8de73719 100644
--- a/vcl/source/gdi/TypeSerializer.cxx
+++ b/vcl/source/gdi/TypeSerializer.cxx
@@ -281,7 +281,6 @@ void TypeSerializer::readGraphic(Graphic& rGraphic)
VectorGraphicDataArray aData(nLength);
mrStream.ReadBytes(aData.getArray(), nLength);
- OUString aPath = mrStream.ReadUniOrByteString(mrStream.GetStreamCharSet());
if (!mrStream.GetError())
{
@@ -301,7 +300,7 @@ void TypeSerializer::readGraphic(Graphic& rGraphic)
}
auto aVectorGraphicDataPtr
- = std::make_shared<VectorGraphicData>(aData, aPath, aDataType);
+ = std::make_shared<VectorGraphicData>(aData, aDataType);
rGraphic = Graphic(aVectorGraphicDataPtr);
}
}
@@ -391,8 +390,8 @@ void TypeSerializer::writeGraphic(const Graphic& rGraphic)
mrStream.WriteUInt32(nSize);
mrStream.WriteBytes(
pVectorGraphicData->getVectorGraphicDataArray().getConstArray(), nSize);
- mrStream.WriteUniOrByteString(pVectorGraphicData->getPath(),
- mrStream.GetStreamCharSet());
+ // For backwards compatibility, used to serialize path
+ mrStream.WriteUniOrByteString(OUString(), mrStream.GetStreamCharSet());
}
else if (aGraphic.IsAnimated())
{
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 6a76e2f9f81f..eba12fd26c44 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -1202,8 +1202,6 @@ bool ImpGraphic::swapOutGraphic(SvStream& rStream)
rStream.WriteBytes(
maVectorGraphicData->getVectorGraphicDataArray().getConstArray(),
maVectorGraphicData->getVectorGraphicDataArrayLength());
-
- rStream.WriteUniOrByteString(maVectorGraphicData->getPath(), rStream.GetStreamCharSet());
}
else if (ImplIsAnimated())
{
@@ -1565,8 +1563,6 @@ bool ImpGraphic::swapInGraphic(SvStream& rStream)
rStream.ReadBytes(aNewData.getArray(), nVectorGraphicDataArrayLength);
- OUString aPath = rStream.ReadUniOrByteString(rStream.GetStreamCharSet());
-
if (rStream.GetError())
return false;
@@ -1590,7 +1586,7 @@ bool ImpGraphic::swapInGraphic(SvStream& rStream)
return false;
}
- auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aNewData, aPath, aDataType);
+ auto aVectorGraphicDataPtr = std::make_shared<VectorGraphicData>(aNewData, aDataType);
if (!rStream.GetError())
{
diff --git a/vcl/source/gdi/vectorgraphicdata.cxx b/vcl/source/gdi/vectorgraphicdata.cxx
index a8134a60c852..046cf9e503ad 100644
--- a/vcl/source/gdi/vectorgraphicdata.cxx
+++ b/vcl/source/gdi/vectorgraphicdata.cxx
@@ -198,7 +198,7 @@ void VectorGraphicData::ensureSequenceAndRange()
const uno::Reference< io::XInputStream > myInputStream(new comphelper::SequenceInputStream(maVectorGraphicDataArray));
if (myInputStream.is())
- maSequence = comphelper::sequenceToContainer<std::deque<css::uno::Reference< css::graphic::XPrimitive2D >>>(xSvgParser->getDecomposition(myInputStream, maPath));
+ maSequence = comphelper::sequenceToContainer<std::deque<css::uno::Reference< css::graphic::XPrimitive2D >>>(xSvgParser->getDecomposition(myInputStream, OUString()));
break;
}
@@ -232,7 +232,7 @@ void VectorGraphicData::ensureSequenceAndRange()
aSequence = comphelper::containerToSequence(aVector);
}
- maSequence = comphelper::sequenceToContainer<std::deque<css::uno::Reference< css::graphic::XPrimitive2D >>>(xEmfParser->getDecomposition(myInputStream, maPath, aSequence));
+ maSequence = comphelper::sequenceToContainer<std::deque<css::uno::Reference< css::graphic::XPrimitive2D >>>(xEmfParser->getDecomposition(myInputStream, OUString(), aSequence));
}
break;
@@ -292,11 +292,9 @@ std::pair<VectorGraphicData::State, size_t> VectorGraphicData::getSizeBytes() co
VectorGraphicData::VectorGraphicData(
const VectorGraphicDataArray& rVectorGraphicDataArray,
- const OUString& rPath,
VectorGraphicDataType eVectorDataType,
sal_Int32 nPageIndex)
: maVectorGraphicDataArray(rVectorGraphicDataArray),
- maPath(rPath),
mbSequenceCreated(false),
maRange(),
maSequence(),
@@ -311,7 +309,6 @@ VectorGraphicData::VectorGraphicData(
const OUString& rPath,
VectorGraphicDataType eVectorDataType)
: maVectorGraphicDataArray(),
- maPath(rPath),
mbSequenceCreated(false),
maRange(),
maSequence(),
More information about the Libreoffice-commits
mailing list