diff options
author | Marco Cecchetti <marco.cecchetti@collabora.com> | 2016-02-19 18:12:49 +0100 |
---|---|---|
committer | Marco Cecchetti <marco.cecchetti@collabora.com> | 2016-02-19 18:12:49 +0100 |
commit | 8aeeacf7f6b87d55d728cacaf07c8ea37dccb7e8 (patch) | |
tree | 8b2c459eef711e5484e8ff0eeb8ce725131c9ea4 | |
parent | bb21dcf1585250bd902eb5765c54d2cbb400b26a (diff) |
pdf export - avoid to export png as jpegprivate/mcecchetti/amd/pdf-export-jpeg
Change-Id: Iafa5d4b347da46dedb9431b6870f34b2b6fcad99
-rw-r--r-- | vcl/source/gdi/pdfextoutdevdata.cxx | 26 | ||||
-rw-r--r-- | vcl/source/gdi/pdfwriter_impl2.cxx | 10 |
2 files changed, 23 insertions, 13 deletions
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index 488278a81739..8c7590bff04d 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -409,15 +409,22 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc else if ( aBeg->eAct == PDFExtOutDevDataSync::EndGroupGfxLink ) { Graphic& rGraphic = mGraphics.front(); - if ( rGraphic.IsLink() && - rGraphic.GetLink().GetType() == GFX_LINK_TYPE_NATIVE_JPG && - mParaRects.size() >= 2 ) + if ( rGraphic.IsLink() ) { - mbGroupIgnoreGDIMtfActions = - rOutDevData.HasAdequateCompression( - rGraphic, mParaRects[0], mParaRects[1]); - if ( !mbGroupIgnoreGDIMtfActions ) + GfxLinkType eType = rGraphic.GetLink().GetType(); + if ( eType == GFX_LINK_TYPE_NATIVE_JPG && + mParaRects.size() >= 2 ) + { + mbGroupIgnoreGDIMtfActions = + rOutDevData.HasAdequateCompression( + rGraphic, mParaRects[0], mParaRects[1]); + if ( !mbGroupIgnoreGDIMtfActions ) + mCurrentGraphic = rGraphic; + } + else if ( eType == GFX_LINK_TYPE_NATIVE_PNG ) + { mCurrentGraphic = rGraphic; + } } break; } @@ -472,10 +479,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 3cc7b255343e..c9f4400a85da 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; |