[Libreoffice-commits] core.git: vcl/source
Miklos Vajna
vmiklos at collabora.co.uk
Mon Feb 20 10:59:38 UTC 2017
vcl/source/filter/ipdf/pdfread.cxx | 10 ++++++----
vcl/source/gdi/pdfwriter_impl.cxx | 13 +++++++++++--
vcl/source/gdi/pdfwriter_impl.hxx | 3 +++
3 files changed, 20 insertions(+), 6 deletions(-)
New commits:
commit 711bc66ca34d3b1293a01fa7db16522b87055495
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Feb 20 10:05:57 2017 +0100
vcl PDF filter: avoid copy&paste
By using a single ifdef block for the disable-pdfium case and by adding
PDFWriterImpl::BitmapEmit::getObject().
Change-Id: Ia21e16d469bc75e9b1a95342ed01caef3e91ccd9
Reviewed-on: https://gerrit.libreoffice.org/34462
Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
Tested-by: Jenkins <ci at libreoffice.org>
diff --git a/vcl/source/filter/ipdf/pdfread.cxx b/vcl/source/filter/ipdf/pdfread.cxx
index d998402..d7de71e 100644
--- a/vcl/source/filter/ipdf/pdfread.cxx
+++ b/vcl/source/filter/ipdf/pdfread.cxx
@@ -37,12 +37,9 @@ double pointToPixel(double fPoint)
return fPoint / 72 * 96;
}
-#endif
-
/// Does PDF to PNG conversion using pdfium.
bool generatePreview(SvStream& rStream, Graphic& rGraphic)
{
-#if HAVE_FEATURE_PDFIUM
FPDF_LIBRARY_CONFIG aConfig;
aConfig.version = 2;
aConfig.m_pUserFontPaths = nullptr;
@@ -109,13 +106,18 @@ bool generatePreview(SvStream& rStream, Graphic& rGraphic)
FPDF_ClosePage(pPdfPage);
FPDF_CloseDocument(pPdfDocument);
FPDF_DestroyLibrary();
+
+ return true;
+}
#else
+bool generatePreview(SvStream& rStream, Graphic& rGraphic)
+{
(void)rStream;
(void)rGraphic;
-#endif
return true;
}
+#endif // HAVE_FEATURE_PDFIUM
}
diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx
index 8eb3fad..b18f4fc 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -11320,7 +11320,7 @@ void PDFWriterImpl::drawBitmap( const Point& rDestPoint, const Size& rDestSize,
aLine.append( ' ' );
m_aPages.back().appendPoint( rDestPoint + Point( 0, rDestSize.Height()-1 ), aLine );
aLine.append( " cm\n/Im" );
- sal_Int32 nObject = rBitmap.m_nFormObject > 0 ? rBitmap.m_nFormObject : rBitmap.m_nObject;
+ sal_Int32 nObject = rBitmap.getObject();
aLine.append(nObject);
aLine.append( " Do Q\n" );
if( nCheckWidth == 0 || nCheckHeight == 0 )
@@ -11378,7 +11378,7 @@ const PDFWriterImpl::BitmapEmit& PDFWriterImpl::createBitmapEmit( const BitmapEx
OStringBuffer aObjName( 16 );
aObjName.append( "Im" );
- sal_Int32 nObject = it->m_nFormObject > 0 ? it->m_nFormObject : it->m_nObject;
+ sal_Int32 nObject = it->getObject();
aObjName.append(nObject);
pushResource( ResXObject, aObjName.makeStringAndClear(), nObject );
@@ -13236,4 +13236,13 @@ PDFWriterImpl::JPGEmit::JPGEmit(PDFWriterImpl::JPGEmit&& rOther)
m_nObject = rOther.m_nObject;
m_bTrueColor = rOther.m_bTrueColor;
}
+
+sal_Int32 PDFWriterImpl::BitmapEmit::getObject() const
+{
+ if (m_nFormObject > 0)
+ return m_nFormObject;
+ else
+ return m_nObject;
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 14b41db..1e25de4 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -221,6 +221,9 @@ public:
m_nFormObject(0)
{
}
+
+ /// Returns the ID one should use when referring to this bitmap.
+ sal_Int32 getObject() const;
};
struct JPGEmit
More information about the Libreoffice-commits
mailing list