summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2023-04-03 09:34:54 +0100
committerMichael Meeks <michael.meeks@collabora.com>2023-04-27 11:25:41 +0100
commit6810d0f5b61a779588261e8ff848b9274a4cec98 (patch)
tree1d0b819d0b4e400ee092c28282375a20fef17bad
parentsw floattable, crashtesting: fix PDF export of fdo72790-1.docx, part 4 (diff)
downloadcore-6810d0f5b61a779588261e8ff848b9274a4cec98.tar.gz
core-6810d0f5b61a779588261e8ff848b9274a4cec98.zip
BinaryDataContainer: account for in-memory size of un-compressed image.
Change-Id: Ia86d4dda706959bb58e941e65f2b2f7fffa8dc3d Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
-rw-r--r--include/vcl/BinaryDataContainer.hxx3
-rw-r--r--include/vcl/gfxlink.hxx3
-rw-r--r--vcl/source/gdi/impgraph.cxx5
-rw-r--r--vcl/source/graphic/BinaryDataContainer.cxx2
4 files changed, 13 insertions, 0 deletions
diff --git a/include/vcl/BinaryDataContainer.hxx b/include/vcl/BinaryDataContainer.hxx
index e9e46a04e667..e178ad6c4d62 100644
--- a/include/vcl/BinaryDataContainer.hxx
+++ b/include/vcl/BinaryDataContainer.hxx
@@ -53,6 +53,9 @@ public:
/// writes the contents to the given stream
std::size_t writeToStream(SvStream& rStream) const;
+ /// return the in-memory size in bytes as of now.
+ std::size_t getSizeBytes() const;
+
size_t calculateHash() const;
};
diff --git a/include/vcl/gfxlink.hxx b/include/vcl/gfxlink.hxx
index 8c0f5fd32b05..531633b3f738 100644
--- a/include/vcl/gfxlink.hxx
+++ b/include/vcl/gfxlink.hxx
@@ -85,6 +85,9 @@ public:
sal_uInt32 GetDataSize() const { return maDataContainer.getSize(); }
const sal_uInt8* GetData() const;
+ /// return the in-memory size as of now.
+ size_t getSizeBytes() const { return maDataContainer.getSizeBytes(); }
+
const BinaryDataContainer& getDataContainer() const
{
return maDataContainer;
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 84df1765569c..76598c9945e1 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -999,6 +999,9 @@ sal_uLong ImpGraphic::getSizeBytes() const
break;
}
+ if (mpGfxLink)
+ mnSizeBytes += mpGfxLink->getSizeBytes();
+
return mnSizeBytes;
}
@@ -1431,6 +1434,8 @@ void ImpGraphic::dumpState(rtl::OStringBuffer &rState)
rState.append(static_cast<sal_Int32>(meType));
rState.append("\tsize:\t");
rState.append(static_cast<sal_Int64>(mnSizeBytes));
+ rState.append("\tgfxl:\t");
+ rState.append(static_cast<sal_Int64>(mpGfxLink ? mpGfxLink->getSizeBytes() : -1));
rState.append("\t");
rState.append(static_cast<sal_Int32>(maSwapInfo.maSizePixel.Width()));
rState.append("x");
diff --git a/vcl/source/graphic/BinaryDataContainer.cxx b/vcl/source/graphic/BinaryDataContainer.cxx
index b35195b7d27e..31561d9e16e3 100644
--- a/vcl/source/graphic/BinaryDataContainer.cxx
+++ b/vcl/source/graphic/BinaryDataContainer.cxx
@@ -74,6 +74,8 @@ std::size_t BinaryDataContainer::writeToStream(SvStream& rStream) const
size_t BinaryDataContainer::getSize() const { return mpData ? mpData->size() : 0; }
+size_t BinaryDataContainer::getSizeBytes() const { return getSize(); }
+
bool BinaryDataContainer::isEmpty() const { return !mpData || mpData->empty(); }
const sal_uInt8* BinaryDataContainer::getData() const { return mpData ? mpData->data() : nullptr; }