From dcfac443c608aec2ce4e5fa30a3dd021b5a8bfd3 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Mon, 28 Dec 2020 10:03:18 +0900 Subject: vcl: use BinaryDataContianer in VectorGraphicData MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- vcl/source/gdi/pdfwriter_impl.cxx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'vcl/source/gdi/pdfwriter_impl.cxx') 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(rEmbeddedFile.m_pData->size())); + aLine.append(static_cast(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>(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(rArray.getConstArray()), nLength); + sal_Int32 aIndex = m_aExternalPDFStreams.store(rDataContainer); rEmit.m_nExternalPDFPageIndex = rGraphic.getVectorGraphicData()->getPageIndex(); rEmit.m_nExternalPDFDataIndex = aIndex; } -- cgit