diff options
author | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-05-25 16:37:04 +0200 |
---|---|---|
committer | Miklos Vajna <vmiklos@collabora.co.uk> | 2017-05-25 21:15:00 +0200 |
commit | 3a2ccb419c5face6fbf56b1a4877e675d4cd5fe8 (patch) | |
tree | a2490fd4b9ca47425becac5e021cc280f28a26b9 /vcl | |
parent | f80c3e37e59285875bc9ec025661bcf1b8fc60eb (diff) |
tdf#108056 PDF export: work with double page size
Our coordinate system has the origo in the top left corner, PDF's one is
at the bottom left corner. So the page height affects the coordinate of
all widths and y positions. That page width is 870.25 in the case of the
bugdoc, but it was handled as 870 due to the integer rounding. The
coordinates and heights are now closer to the expected ones.
(cherry picked from commit a05dc747caf5b8fef6bd95a999cb6098f2b4dbc7)
Change-Id: I9c7d77298df3850bbc170c9ace18120900d7e3fa
Reviewed-on: https://gerrit.libreoffice.org/38035
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/gdi/pdfwriter.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.cxx | 4 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl.hxx | 10 |
3 files changed, 8 insertions, 8 deletions
diff --git a/vcl/source/gdi/pdfwriter.cxx b/vcl/source/gdi/pdfwriter.cxx index ec612820e15d..28a176ba3c51 100644 --- a/vcl/source/gdi/pdfwriter.cxx +++ b/vcl/source/gdi/pdfwriter.cxx @@ -53,7 +53,7 @@ OutputDevice* PDFWriter::GetReferenceDevice() return xImplementation->getReferenceDevice(); } -void PDFWriter::NewPage( sal_Int32 nPageWidth, sal_Int32 nPageHeight, Orientation eOrientation ) +void PDFWriter::NewPage( double nPageWidth, double nPageHeight, Orientation eOrientation ) { xImplementation->newPage( nPageWidth, nPageHeight, eOrientation ); } diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 3ee96131e070..a4a49436b820 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -1126,7 +1126,7 @@ void PDFWriterImpl::ResourceDict::append( OStringBuffer& rBuf, sal_Int32 nFontDi rBuf.append( "]\n>>\n" ); }; -PDFWriterImpl::PDFPage::PDFPage( PDFWriterImpl* pWriter, sal_Int32 nPageWidth, sal_Int32 nPageHeight, PDFWriter::Orientation eOrientation ) +PDFWriterImpl::PDFPage::PDFPage( PDFWriterImpl* pWriter, double nPageWidth, double nPageHeight, PDFWriter::Orientation eOrientation ) : m_pWriter( pWriter ), m_nPageWidth( nPageWidth ), @@ -2258,7 +2258,7 @@ LogicalFontInstance* PdfBuiltinFontFace::CreateFontInstance( FontSelectPattern& } -void PDFWriterImpl::newPage( sal_Int32 nPageWidth, sal_Int32 nPageHeight, PDFWriter::Orientation eOrientation ) +void PDFWriterImpl::newPage( double nPageWidth, double nPageHeight, PDFWriter::Orientation eOrientation ) { endPage(); m_nCurrentPage = m_aPages.size(); diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index c65e24075e0b..0132897f71ee 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -135,8 +135,8 @@ public: struct PDFPage { PDFWriterImpl* m_pWriter; - sal_Int32 m_nPageWidth; // in inch/72 - sal_Int32 m_nPageHeight; // in inch/72 + double m_nPageWidth; // in inch/72 + double m_nPageHeight; // in inch/72 PDFWriter::Orientation m_eOrientation; sal_Int32 m_nPageObject; sal_Int32 m_nPageIndex; @@ -150,7 +150,7 @@ public: sal_uInt32 m_nDuration; bool m_bHasWidgets; - PDFPage( PDFWriterImpl* pWriter, sal_Int32 nPageWidth, sal_Int32 nPageHeight, PDFWriter::Orientation eOrientation ); + PDFPage( PDFWriterImpl* pWriter, double nPageWidth, double nPageHeight, PDFWriter::Orientation eOrientation ); ~PDFPage(); void beginStream(); @@ -191,7 +191,7 @@ public: // appends a horizontal waveline with vertical offset (helper for drawWaveLine) void appendWaveLine( sal_Int32 nLength, sal_Int32 nYOffset, sal_Int32 nDelta, OStringBuffer& rBuffer ) const; - sal_Int32 getHeight() const { return m_nPageHeight ? m_nPageHeight : m_pWriter->m_nInheritedPageHeight; } + double getHeight() const { return m_nPageHeight ? m_nPageHeight : m_pWriter->m_nInheritedPageHeight; } }; friend struct PDFPage; @@ -1079,7 +1079,7 @@ public: OutputDevice* getReferenceDevice(); /* document structure */ - void newPage( sal_Int32 nPageWidth , sal_Int32 nPageHeight, PDFWriter::Orientation eOrientation ); + void newPage( double nPageWidth , double nPageHeight, PDFWriter::Orientation eOrientation ); bool emit(); const std::set< PDFWriter::ErrorCode > & getErrors() const { return m_aErrors;} void insertError( PDFWriter::ErrorCode eErr ) { m_aErrors.insert( eErr ); } |