summaryrefslogtreecommitdiff
path: root/sd/source/filter
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-06-08 22:54:48 -0400
committerAshod Nakashian <ashnakash@gmail.com>2018-06-18 02:26:27 +0200
commitc8d95ccecfcd31b720fdff67bbd6acbdceaf2546 (patch)
tree7309ba29c7ded6c00015fa1254bd10f2d92c1dea /sd/source/filter
parentcbd0d1da85a7ae6b35023274c7267872b3d920e7 (diff)
vcl: share GfxLink
When importing PDF as images, we store the PDF stream in the GfxLink. For large PDFs storing a copy of the full PDF with each page is overkill. For example a 10MB PDF with 200 pages will consume 2GB of memory! Change-Id: I99913514cf5c562683080bc817668095bee69427 Reviewed-on: https://gerrit.libreoffice.org/55571 Tested-by: Jenkins Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'sd/source/filter')
-rw-r--r--sd/source/filter/pdf/sdpdffilter.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx
index 7f58ba6c8d1f..db7af07b58ce 100644
--- a/sd/source/filter/pdf/sdpdffilter.cxx
+++ b/sd/source/filter/pdf/sdpdffilter.cxx
@@ -112,7 +112,8 @@ bool SdPdfFilter::Import()
const size_t nGraphicContentSize = aPdfData.getLength();
std::unique_ptr<sal_uInt8[]> pGraphicContent(new sal_uInt8[nGraphicContentSize]);
memcpy(pGraphicContent.get(), aPdfData.get(), nGraphicContentSize);
- GfxLink aGfxLink(std::move(pGraphicContent), nGraphicContentSize, GfxLinkType::NativePdf);
+ std::shared_ptr<GfxLink> pGfxLink(std::make_shared<GfxLink>(
+ std::move(pGraphicContent), nGraphicContentSize, GfxLinkType::NativePdf));
auto pPdfData = std::make_shared<uno::Sequence<sal_Int8>>(aPdfData);
mrDocument.CreateFirstPages();
@@ -128,7 +129,7 @@ bool SdPdfFilter::Import()
Graphic aGraphic(aBitmap);
aGraphic.setPdfData(pPdfData);
aGraphic.setPageNumber(nPageNumber);
- aGraphic.SetGfxLink(aGfxLink);
+ aGraphic.SetGfxLink(pGfxLink);
// Create the page and insert the Graphic.
SdPage* pPage = mrDocument.GetSdPage(nPageNumber++, PageKind::Standard);