summaryrefslogtreecommitdiff
path: root/vcl/source/filter/ipdf/pdfread.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'vcl/source/filter/ipdf/pdfread.cxx')
-rw-r--r--vcl/source/filter/ipdf/pdfread.cxx11
1 files changed, 8 insertions, 3 deletions
diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx
index 53008ea5e958..da36c3433350 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -346,6 +346,9 @@ size_t ImportPDFUnloaded(const OUString& rURL, std::vector<std::pair<Graphic, Si
if (nPageCount <= 0)
return 0;
+ // dummy Bitmap
+ Bitmap aBitmap(Size(1, 1), 24);
+
for (size_t nPageIndex = 0; nPageIndex < static_cast<size_t>(nPageCount); ++nPageIndex)
{
double fPageWidth = 0;
@@ -357,9 +360,11 @@ size_t ImportPDFUnloaded(const OUString& rURL, std::vector<std::pair<Graphic, Si
const size_t nPageWidth = pointToPixel(fPageWidth, fResolutionDPI);
const size_t nPageHeight = pointToPixel(fPageHeight, fResolutionDPI);
- // Create the Graphic and link the original PDF stream.
- Graphic aGraphic;
- aGraphic.setPdfData(pPdfData); // TODO: Skip if unchanged.
+ // Create the Graphic with a dummy Bitmap and link the original PDF stream.
+ // We swap out this Graphic as soon as possible, and a later swap in
+ // actually renders the correct Bitmap on demand.
+ Graphic aGraphic(aBitmap);
+ aGraphic.setPdfData(pPdfData);
aGraphic.setPageNumber(nPageIndex);
aGraphic.SetSharedLink(pGfxLink);