summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-06-06 00:51:10 -0400
committerAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-06-06 00:53:58 -0400
commitdfee8ca7095a293fc58877aa299aaaa4a789392c (patch)
tree271f4836f4e55a577174e880227dce9c9f0084d9
parentvcl: fix pdf rendering regression (diff)
downloadcore-private/Ashod/pdfium_on_master_fixed.tar.gz
core-private/Ashod/pdfium_on_master_fixed.zip
vcl: svx: misc improvements to pdfium importing private/Ashod/pdfium_on_master_fixed
Change-Id: I58f2fd973a731b148f40b37139cd74bac097a7d2
-rw-r--r--include/svx/xmlgrhlp.hxx1
-rw-r--r--include/vcl/graph.hxx2
-rw-r--r--include/vcl/pdfread.hxx2
-rw-r--r--sd/source/filter/pdf/sdpdffilter.cxx2
-rw-r--r--sdext/source/pdfimport/wrapper/wrapper.cxx2
-rw-r--r--svx/source/svdraw/svdpdf.cxx2
-rw-r--r--svx/source/xml/xmlgrhlp.cxx8
-rw-r--r--svx/source/xoutdev/_xoutbmp.cxx4
-rw-r--r--vcl/source/filter/ipdf/pdfread.cxx6
-rw-r--r--vcl/source/gdi/graph.cxx2
-rw-r--r--vcl/source/gdi/impgraph.cxx3
11 files changed, 18 insertions, 16 deletions
diff --git a/include/svx/xmlgrhlp.hxx b/include/svx/xmlgrhlp.hxx
index d6973104f72e..4d9fa58a1b49 100644
--- a/include/svx/xmlgrhlp.hxx
+++ b/include/svx/xmlgrhlp.hxx
@@ -25,6 +25,7 @@
#include <vcl/GraphicObject.hxx>
#include <vector>
#include <set>
+#include <unordered_map>
#include <utility>
#include <com/sun/star/document/XGraphicObjectResolver.hpp>
#include <com/sun/star/document/XGraphicStorageHandler.hpp>
diff --git a/include/vcl/graph.hxx b/include/vcl/graph.hxx
index cd2e48c273f7..24c3f4e796a2 100644
--- a/include/vcl/graph.hxx
+++ b/include/vcl/graph.hxx
@@ -231,7 +231,7 @@ public:
const VectorGraphicDataPtr& getVectorGraphicData() const;
void setPdfData(const std::shared_ptr<css::uno::Sequence<sal_Int8>>& rPdfData);
- std::shared_ptr<css::uno::Sequence<sal_Int8>> getPdfData() const;
+ const std::shared_ptr<css::uno::Sequence<sal_Int8>>& getPdfData() const;
bool hasPdfData() const;
/// Set the page number of the multi-page source this Graphic is rendered from.
diff --git a/include/vcl/pdfread.hxx b/include/vcl/pdfread.hxx
index 2e3f2fa36994..0fc3249cd6a3 100644
--- a/include/vcl/pdfread.hxx
+++ b/include/vcl/pdfread.hxx
@@ -10,8 +10,8 @@
#ifndef INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX
#define INCLUDED_VCL_SOURCE_FILTER_IPDF_PDFREAD_HXX
-#include <tools/stream.hxx>
#include <vector>
+#include <tools/stream.hxx>
namespace com
{
diff --git a/sd/source/filter/pdf/sdpdffilter.cxx b/sd/source/filter/pdf/sdpdffilter.cxx
index ad00ae0ba0ba..7f58ba6c8d1f 100644
--- a/sd/source/filter/pdf/sdpdffilter.cxx
+++ b/sd/source/filter/pdf/sdpdffilter.cxx
@@ -144,7 +144,7 @@ bool SdPdfFilter::Import()
Point aPos(0, 0);
pPage->InsertObject(new SdrGrafObj(pPage->getSdrModelFromSdrPage(), aGraphic,
- ::tools::Rectangle(aPos, aGrfSize)));
+ tools::Rectangle(aPos, aGrfSize)));
}
return true;
diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx
index affd350a6a8c..d34573d65ee6 100644
--- a/sdext/source/pdfimport/wrapper/wrapper.cxx
+++ b/sdext/source/pdfimport/wrapper/wrapper.cxx
@@ -1009,7 +1009,7 @@ public:
};
bool xpdf_ImportFromFile(const OUString& rURL,
- const ContentSinkSharedPtr& rSink,
+ const ContentSinkSharedPtr& rSink,
const uno::Reference<task::XInteractionHandler>& xIHdl,
const OUString& rPwd,
const uno::Reference<uno::XComponentContext>& xContext,
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index b47a6aadc16c..020141784d13 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -971,7 +971,7 @@ void ImpSdrPdfImport::ImportText(const Point& rPos, const Size& rSize, const OUS
Size aSize(FRound(rSize.Width() * mfScaleX), FRound(rSize.Height() * mfScaleY));
if (eAlg == ALIGN_BASELINE)
- aPos.AdjustY(-(FRound(aFontMetric.GetAscent() * mfScaleY)));
+ aPos.AdjustY(-FRound(aFontMetric.GetAscent() * mfScaleY));
else if (eAlg == ALIGN_BOTTOM)
aPos.AdjustY(-nTextHeight);
diff --git a/svx/source/xml/xmlgrhlp.cxx b/svx/source/xml/xmlgrhlp.cxx
index 238b8dda3c91..988341d528e1 100644
--- a/svx/source/xml/xmlgrhlp.cxx
+++ b/svx/source/xml/xmlgrhlp.cxx
@@ -764,10 +764,11 @@ OUString SvXMLGraphicHelper::implSaveGraphic(css::uno::Reference<css::graphic::X
std::unique_ptr<SvStream> pStream(utl::UcbStreamHelper::CreateStream(aStream.xStream));
if (bUseGfxLink && aGfxLink.GetDataSize() && aGfxLink.GetData())
{
- if (aGraphic.hasPdfData())
+ const std::shared_ptr<uno::Sequence<sal_Int8>>& rPdfData = aGraphic.getPdfData();
+ if (rPdfData && rPdfData->hasElements())
{
// See if we have this PDF already, and avoid duplicate storage.
- auto aIt = maExportPdf.find(aGraphic.getPdfData().get());
+ auto aIt = maExportPdf.find(rPdfData.get());
if (aIt != maExportPdf.end())
{
auto const& aURLAndMimePair = aIt->second;
@@ -779,8 +780,7 @@ OUString SvXMLGraphicHelper::implSaveGraphic(css::uno::Reference<css::graphic::X
// vcl::ImportPDF() possibly downgraded the PDF data from a
// higher PDF version, while aGfxLink still contains the
// original data provided by the user.
- std::shared_ptr<uno::Sequence<sal_Int8>> pPdfData = aGraphic.getPdfData();
- pStream->WriteBytes(pPdfData->getConstArray(), pPdfData->getLength());
+ pStream->WriteBytes(rPdfData->getConstArray(), rPdfData->getLength());
}
else
{
diff --git a/svx/source/xoutdev/_xoutbmp.cxx b/svx/source/xoutdev/_xoutbmp.cxx
index a37508c2fcd1..05998009e14a 100644
--- a/svx/source/xoutdev/_xoutbmp.cxx
+++ b/svx/source/xoutdev/_xoutbmp.cxx
@@ -182,8 +182,8 @@ ErrCode XOutBitmap::WriteGraphic( const Graphic& rGraphic, OUString& rFileName,
SfxMedium aMedium(aURL.GetMainURL(INetURLObject::DecodeMechanism::NONE), StreamMode::WRITE|StreamMode::SHARE_DENYNONE|StreamMode::TRUNC);
if (SvStream* pOutStream = aMedium.GetOutStream())
{
- std::shared_ptr<uno::Sequence<sal_Int8>> pPdfData = rGraphic.getPdfData();
- pOutStream->WriteBytes(pPdfData->getConstArray(), pPdfData->getLength());
+ const std::shared_ptr<uno::Sequence<sal_Int8>>& rPdfData = rGraphic.getPdfData();
+ pOutStream->WriteBytes(rPdfData->getConstArray(), rPdfData->getLength());
aMedium.Commit();
if (!aMedium.GetError())
nErr = ERRCODE_NONE;
diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx
index 4ac2503ec665..d98c856c6704 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -60,7 +60,7 @@ inline double pointToPixel(const double fPoint, const double fResolutionDPI)
/// Does PDF to bitmap conversion using pdfium.
size_t generatePreview(SvStream& rStream, std::vector<Bitmap>& rBitmaps, sal_uInt64 nPos,
- sal_uInt64 nSize, const size_t nFirstPage = 0, int nPages = 1,
+ sal_uInt64 nSize, const size_t nFirstPage, int nPages,
const double fResolutionDPI = 96.)
{
FPDF_LIBRARY_CONFIG aConfig;
@@ -197,7 +197,7 @@ bool getCompatibleStream(SvStream& rInStream, SvStream& rOutStream, sal_uInt64 n
}
#else
size_t generatePreview(SvStream&, std::vector<Bitmap>&, sal_uInt64 nPos, sal_uInt64 nSize,
- size_t nFirstPage = 0, int nLastPage = 0, const double fResolutionDPI = 96.)
+ size_t nFirstPage, int nLastPage, const double fResolutionDPI = 96.)
{
(void)rStream;
(void)rBitmap;
@@ -207,7 +207,7 @@ size_t generatePreview(SvStream&, std::vector<Bitmap>&, sal_uInt64 nPos, sal_uIn
(void)nLastPage;
(void)fResolutionDPI;
- return false;
+ return 0;
}
bool getCompatibleStream(SvStream& rInStream, SvStream& rOutStream, sal_uInt64 nPos,
diff --git a/vcl/source/gdi/graph.cxx b/vcl/source/gdi/graph.cxx
index adc7d771c94d..52e4e9e74ae8 100644
--- a/vcl/source/gdi/graph.cxx
+++ b/vcl/source/gdi/graph.cxx
@@ -563,7 +563,7 @@ void Graphic::setPdfData(const std::shared_ptr<uno::Sequence<sal_Int8>>& rPdfDat
mxImpGraphic->setPdfData(rPdfData);
}
-std::shared_ptr<uno::Sequence<sal_Int8>> Graphic::getPdfData() const
+const std::shared_ptr<uno::Sequence<sal_Int8>>& Graphic::getPdfData() const
{
return mxImpGraphic->getPdfData();
}
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 32c8dfee44a8..87a7bd64a398 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -242,7 +242,8 @@ ImpGraphic::ImpGraphic(GraphicExternalLink const & rGraphicExternalLink) :
mbDummyContext ( false ),
maGraphicExternalLink(rGraphicExternalLink),
maLastUsed (std::chrono::high_resolution_clock::now()),
- mbPrepared (false)
+ mbPrepared (false),
+ mnPageNumber(-1)
{
}