[Libreoffice-commits] core.git: Branch 'feature/fixes16' - vcl/source

Marco Cecchetti marco.cecchetti at collabora.com
Fri Feb 19 17:25:06 UTC 2016


 vcl/source/gdi/pdfextoutdevdata.cxx |   21 +++++++++++++--------
 vcl/source/gdi/pdfwriter_impl2.cxx  |   10 ++++++++--
 2 files changed, 21 insertions(+), 10 deletions(-)

New commits:
commit 131123238dbf003d22d54f6069f95c693d751524
Author: Marco Cecchetti <marco.cecchetti at collabora.com>
Date:   Fri Feb 19 18:12:49 2016 +0100

    pdf export - avoid to export png as jpeg
    
    Conflicts:
    	vcl/source/gdi/pdfextoutdevdata.cxx
    
    Change-Id: Iafa5d4b347da46dedb9431b6870f34b2b6fcad99

diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx
index ed66e76..b787120 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -410,12 +410,20 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc
                         if ( rOutDevData.GetIsLosslessCompression() && !rOutDevData.GetIsReduceImageResolution() )
                         {
                             Graphic& rGraphic = mGraphics.front();
-                            if ( rGraphic.IsLink() && rGraphic.GetLink().GetType() == GFX_LINK_TYPE_NATIVE_JPG )
+                            if ( rGraphic.IsLink() )
                             {
-                                mbGroupIgnoreGDIMtfActions = true;
+                                GfxLinkType eType = rGraphic.GetLink().GetType();
+                                if ( eType == GFX_LINK_TYPE_NATIVE_JPG )
+                                {
+                                    mbGroupIgnoreGDIMtfActions = true;
+                                    if ( !mbGroupIgnoreGDIMtfActions )
+                                        mCurrentGraphic = rGraphic;
+                                }
+                                else if ( eType == GFX_LINK_TYPE_NATIVE_PNG )
+                                {
+                                    mCurrentGraphic = rGraphic;
+                                }
                             }
-                            if ( !mbGroupIgnoreGDIMtfActions )
-                                mCurrentGraphic = rGraphic;
                         }
                         break;
                     }
@@ -470,10 +478,7 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc
                     }
                     mbGroupIgnoreGDIMtfActions = false;
                 }
-                else
-                {
-                    mCurrentGraphic.Clear();
-                }
+                mCurrentGraphic.Clear();
             }
             break;
             case PDFExtOutDevDataSync::CreateNamedDest:
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index 7e1c9f9..0e14e4d 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -96,7 +96,13 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
             aBitmapEx.Mirror( nMirrorFlags );
         }
 
-        bool bIsJpeg = (i_Graphic.GetType() != GRAPHIC_NONE) && (i_Graphic.GetBitmapEx() == aBitmapEx);
+        bool bIsJpeg = false, bIsPng = false;
+        if( i_Graphic.GetType() != GRAPHIC_NONE && i_Graphic.GetBitmapEx() == aBitmapEx )
+        {
+            GfxLinkType eType = i_Graphic.GetLink().GetType();
+            bIsJpeg = (eType == GFX_LINK_TYPE_NATIVE_JPG);
+            bIsPng = (eType == GFX_LINK_TYPE_NATIVE_PNG);
+        }
 
         if( i_rContext.m_nMaxImageResolution > 50 )
         {
@@ -154,7 +160,7 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
                     aBitmapEx.Convert( eConv );
             }
             bool bUseJPGCompression = !i_rContext.m_bOnlyLosslessCompression;
-            if ( ( aSizePixel.Width() < 32 ) || ( aSizePixel.Height() < 32 ) )
+            if ( bIsPng || ( aSizePixel.Width() < 32 ) || ( aSizePixel.Height() < 32 ) )
                 bUseJPGCompression = false;
 
             SvMemoryStream  aStrm;


More information about the Libreoffice-commits mailing list