vcl/source/gdi/pdfwriter_impl.cxx |   39 ++++++++++++++++++++------------------
 vcl/source/gdi/pdfwriter_impl.hxx |    2 +
 2 files changed, 23 insertions(+), 18 deletions(-)

New commits:
commit f7a2f63994e22c99010c1d25a4493a8a0c57866e
Author:     Tomaž Vajngerl <tomaz.vajng...@collabora.co.uk>
AuthorDate: Mon Dec 30 20:32:50 2019 +0100
Commit:     Tomaž Vajngerl <qui...@gmail.com>
CommitDate: Tue Dec 31 00:09:41 2019 +0100

    pdf: move PDFPage dependency out of Matrix3 class (append method)
    
    PDFPage should be responsible to append the Matrix3 data and not
    the other way arround.
    
    This is needed so it can be moved into it's own class.
    
    Change-Id: I98ca1830e7105b73fe26a0559df99da2b2df4307
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/86035
    Reviewed-by: Tomaž Vajngerl <qui...@gmail.com>
    Tested-by: Tomaž Vajngerl <qui...@gmail.com>

diff --git a/vcl/source/gdi/pdfwriter_impl.cxx 
b/vcl/source/gdi/pdfwriter_impl.cxx
index 9599ca737822..1ec13034a9bf 100644
--- a/vcl/source/gdi/pdfwriter_impl.cxx
+++ b/vcl/source/gdi/pdfwriter_impl.cxx
@@ -566,7 +566,10 @@ public:
     void translate( double tx, double ty );
     void invert();
 
-    void append( PDFPage const & rPage, OStringBuffer& rBuffer );
+    double get(size_t i) const
+    {
+        return f[i];
+    }
 
     Point transform( const Point& rPoint ) const;
 };
@@ -670,19 +673,6 @@ void Matrix3::invert()
     set( fn );
 }
 
-void Matrix3::append( PDFPage const & rPage, OStringBuffer& rBuffer )
-{
-    appendDouble( f[0], rBuffer );
-    rBuffer.append( ' ' );
-    appendDouble( f[1], rBuffer );
-    rBuffer.append( ' ' );
-    appendDouble( f[2], rBuffer );
-    rBuffer.append( ' ' );
-    appendDouble( f[3], rBuffer );
-    rBuffer.append( ' ' );
-    rPage.appendPoint( Point( static_cast<long>(f[4]), static_cast<long>(f[5]) 
), rBuffer );
-}
-
 PDFPage::PDFPage( PDFWriterImpl* pWriter, double nPageWidth, double 
nPageHeight, PDFWriter::Orientation eOrientation )
         :
         m_pWriter( pWriter ),
@@ -1242,7 +1232,20 @@ void PDFPage::appendWaveLine( sal_Int32 nWidth, 
sal_Int32 nY, sal_Int32 nDelta,
     rBuffer.append( "S\n" );
 }
 
- PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext,
+void PDFPage::appendMatrix3(Matrix3 const & rMatrix, OStringBuffer& rBuffer)
+{
+    appendDouble(rMatrix.get(0), rBuffer);
+    rBuffer.append(' ');
+    appendDouble(rMatrix.get(1), rBuffer);
+    rBuffer.append(' ');
+    appendDouble(rMatrix.get(2), rBuffer);
+    rBuffer.append(' ');
+    appendDouble(rMatrix.get(3), rBuffer);
+    rBuffer.append(' ');
+    appendPoint(Point(long(rMatrix.get(4)), long(rMatrix.get(5))), rBuffer);
+}
+
+PDFWriterImpl::PDFWriterImpl( const PDFWriter::PDFWriterContext& rContext,
                                const css::uno::Reference< 
css::beans::XMaterialHolder >& xEnc,
                                PDFWriter& i_rOuterFace)
         : VirtualDevice(Application::GetDefaultDevice(), 
DeviceFormat::DEFAULT, DeviceFormat::NONE, OUTDEV_PDF),
@@ -5860,7 +5863,7 @@ void PDFWriterImpl::drawVerticalGlyphs(
         aMat.scale( fTempXScale, fYScale );
         aMat.rotate( fAngle+fDeltaAngle );
         aMat.translate( aCurPos.X()+aDeltaPos.X(), aCurPos.Y()+aDeltaPos.Y() );
-        aMat.append( m_aPages.back(), rLine );
+        m_aPages.back().appendMatrix3(aMat, rLine);
         rLine.append( " Tm" );
         if( i == 0 || rGlyphs[i-1].m_nMappedFontId != 
rGlyphs[i].m_nMappedFontId )
         {
@@ -5932,7 +5935,7 @@ void PDFWriterImpl::drawHorizontalGlyphs(
             aMat.scale( fXScale, 1.0 );
             aMat.rotate( fAngle );
             aMat.translate( aCurPos.X(), aCurPos.Y() );
-            aMat.append( m_aPages.back(), rLine );
+            m_aPages.back().appendMatrix3(aMat, rLine);
             rLine.append( " Tm\n" );
         }
         // set up correct font
@@ -7140,7 +7143,7 @@ void PDFWriterImpl::drawTextLine( const Point& rPos, long 
nWidth, FontStrikeout
     Matrix3 aMat;
     aMat.rotate( fAngle );
     aMat.translate( aPos.X(), aPos.Y() );
-    aMat.append( m_aPages.back(), aLine );
+    m_aPages.back().appendMatrix3(aMat, aLine);
     aLine.append( " cm\n" );
 
     if ( aUnderlineColor.GetTransparency() != 0 )
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx 
b/vcl/source/gdi/pdfwriter_impl.hxx
index 0b155145e250..be201c3be127 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -164,6 +164,8 @@ struct PDFPage
     // appends a horizontal waveline with vertical offset (helper for 
drawWaveLine)
     void appendWaveLine( sal_Int32 nLength, sal_Int32 nYOffset, sal_Int32 
nDelta, OStringBuffer& rBuffer ) const;
 
+    void appendMatrix3(Matrix3 const & rMatrix, OStringBuffer& rBuffer);
+
     double getHeight() const { return m_nPageHeight ? m_nPageHeight : 
vcl::pdf::g_nInheritedPageHeight; }
 };
 
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to