summaryrefslogtreecommitdiff
path: root/sd
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2018-06-22 12:58:12 +0200
committerJan Holesovsky <kendy@collabora.com>2019-04-03 17:54:01 +0200
commit8aca771675f7f76c84bbbd117b9dc1cc9c5ada8b (patch)
tree75fc8d4ba7cd5f1ad922534b843a0a24daa5f829 /sd
parent335113741b2f4672a7813d8e6410dc5ec1b45527 (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 d78ccaa328b0..6f8b4ca2c0b3 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, tools::Rectangle(aPos, aGrfSize)));
+ SdrGrafObj* pSdrGrafObj = new SdrGrafObj(rGraphic, tools::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;