summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2018-06-22 12:58:12 +0200
committerAshod Nakashian <ashnakash@gmail.com>2018-06-22 14:44:25 +0200
commit89626f5f52a80e719cb0fdbf533a4b21697db66a (patch)
tree3a6ca59b1ed93d4ff1a96f8ef8616ebde395fd3f /sd
parent3d2b4942214f586f22640e84f6d48fee475521fb (diff)
pdfium: Delay the swap out.
If we swap out too early, the constructor of GraphicObject forces a swap in, so we'd render everything during the load anyway. Change-Id: I0ea1a755242fd57ef28d082ce4bf534a32199f87 Reviewed-on: https://gerrit.libreoffice.org/56286 Reviewed-by: Ashod Nakashian <ashnakash@gmail.com> Tested-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'sd')
-rw-r--r--sd/source/filter/pdf/sdpdffilter.cxx14
1 files changed, 10 insertions, 4 deletions
diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx
index e157bef79de8..fab51f432060 100644
--- a/sd/source/filter/pdf/sdpdffilter.cxx
+++ b/sd/source/filter/pdf/sdpdffilter.cxx
@@ -115,15 +115,15 @@ bool SdPdfFilter::Import()
for (std::pair<Graphic, Size>& aPair : aGraphics)
{
- const Graphic& aGraphic = aPair.first;
+ const Graphic& rGraphic = aPair.first;
const Size& aSize = aPair.second;
- const sal_Int32 nPageNumber = aGraphic.getPageNumber();
+ const sal_Int32 nPageNumber = rGraphic.getPageNumber();
assert(nPageNumber >= 0 && nPageNumber < static_cast<sal_Int32>(aGraphics.size()));
// Create the page and insert the Graphic.
SdPage* pPage = mrDocument.GetSdPage(nPageNumber, PageKind::Standard);
- Size aGrfSize(OutputDevice::LogicToLogic(aSize, aGraphic.GetPrefMapMode(),
+ Size aGrfSize(OutputDevice::LogicToLogic(aSize, rGraphic.GetPrefMapMode(),
MapMode(MapUnit::Map100thMM)));
// Resize to original size based on 72 dpi to preserve page size.
@@ -134,7 +134,13 @@ bool SdPdfFilter::Import()
pPage->SetSize(aGrfSize);
Point aPos(0, 0);
- pPage->InsertObject(new SdrGrafObj(aGraphic, Rectangle(aPos, aGrfSize)));
+ SdrGrafObj* pSdrGrafObj = new SdrGrafObj(rGraphic, Rectangle(aPos, aGrfSize));
+ pPage->InsertObject(pSdrGrafObj);
+
+ // we know that the initial bitmap we provided was just a placeholder,
+ // we need to swap it out, so that on the next swap in, we render the
+ // correct one
+ const_cast<GraphicObject&>(pSdrGrafObj->GetGraphicObject()).SwapOut();
}
return true;