summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/pdfwriter_impl.cxx
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2020-12-28 10:03:18 +0900
committerTomaž Vajngerl <quikee@gmail.com>2021-01-13 07:22:31 +0100
commitdcfac443c608aec2ce4e5fa30a3dd021b5a8bfd3 (patch)
treef1bd5d83427625eadb91d9e3685616efe43e7ada /vcl/source/gdi/pdfwriter_impl.cxx
parent68b1ae7b493eea4d77f36a0c8566ca0224f04798 (diff)
vcl: use BinaryDataContianer in VectorGraphicData
This change is needed so we can use the same data in GfxLink and in VectorGraphicData. Currently the data needed to be duplicated, which is less than ideal. Change-Id: I79419921d09681fa8f0b1ac4bf8ea84199d4aae6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108440 Tested-by: Jenkins Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/source/gdi/pdfwriter_impl.cxx')
-rw-r--r--vcl/source/gdi/pdfwriter_impl.cxx13
1 files changed, 5 insertions, 8 deletions
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index cb1efa987c60..aee37877c7f6 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -4484,12 +4484,12 @@ bool PDFWriterImpl::emitEmbeddedFiles()
aLine.append(rEmbeddedFile.m_nObject);
aLine.append(" 0 obj\n");
aLine.append("<< /Type /EmbeddedFile /Length ");
- aLine.append(static_cast<sal_Int64>(rEmbeddedFile.m_pData->size()));
+ aLine.append(static_cast<sal_Int64>(rEmbeddedFile.m_aDataContainer.getSize()));
aLine.append(" >>\nstream\n");
CHECK_RETURN(writeBuffer(aLine.getStr(), aLine.getLength()));
aLine.setLength(0);
- CHECK_RETURN(writeBuffer(rEmbeddedFile.m_pData->data(), rEmbeddedFile.m_pData->size()));
+ CHECK_RETURN(writeBuffer(rEmbeddedFile.m_aDataContainer.getData(), rEmbeddedFile.m_aDataContainer.getSize()));
aLine.append("\nendstream\nendobj\n\n");
CHECK_RETURN(writeBuffer(aLine.getStr(), aLine.getLength()));
@@ -9003,22 +9003,19 @@ void PDFWriterImpl::createEmbeddedFile(const Graphic& rGraphic, ReferenceXObject
if (!rGraphic.getVectorGraphicData() || rGraphic.getVectorGraphicData()->getVectorGraphicDataType() != VectorGraphicDataType::Pdf)
return;
- sal_uInt32 nLength = rGraphic.getVectorGraphicData()->getVectorGraphicDataArrayLength();
- auto const & rArray = rGraphic.getVectorGraphicData()->getVectorGraphicDataArray();
+ BinaryDataContainer const & rDataContainer = rGraphic.getVectorGraphicData()->getBinaryDataContainer();
if (m_aContext.UseReferenceXObject)
{
- auto pPDFData = std::make_shared<std::vector<sal_Int8>>(rArray.getConstArray(), rArray.getConstArray() + nLength);
-
// Store the original PDF data as an embedded file.
m_aEmbeddedFiles.emplace_back();
m_aEmbeddedFiles.back().m_nObject = createObject();
- m_aEmbeddedFiles.back().m_pData = pPDFData;
+ m_aEmbeddedFiles.back().m_aDataContainer = rDataContainer;
rEmit.m_nEmbeddedObject = m_aEmbeddedFiles.back().m_nObject;
}
else
{
- sal_Int32 aIndex = m_aExternalPDFStreams.store(reinterpret_cast<const sal_uInt8*>(rArray.getConstArray()), nLength);
+ sal_Int32 aIndex = m_aExternalPDFStreams.store(rDataContainer);
rEmit.m_nExternalPDFPageIndex = rGraphic.getVectorGraphicData()->getPageIndex();
rEmit.m_nExternalPDFDataIndex = aIndex;
}