Kaydet (Commit) eab3c3ab authored tarafından Marco Cecchetti's avatar Marco Cecchetti Kaydeden (comit) Michael Meeks

tdf#97662 - Avoid JPEG compressing de-compressed PNG.

Change-Id: Iafa5d4b347da46dedb9431b6870f34b2b6fcad99
üst 8a039afb
...@@ -409,15 +409,21 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc ...@@ -409,15 +409,21 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc
else if ( aBeg->eAct == PDFExtOutDevDataSync::EndGroupGfxLink ) else if ( aBeg->eAct == PDFExtOutDevDataSync::EndGroupGfxLink )
{ {
Graphic& rGraphic = mGraphics.front(); Graphic& rGraphic = mGraphics.front();
if ( rGraphic.IsLink() && if ( rGraphic.IsLink() )
rGraphic.GetLink().GetType() == GFX_LINK_TYPE_NATIVE_JPG &&
mParaRects.size() >= 2 )
{ {
mbGroupIgnoreGDIMtfActions = GfxLinkType eType = rGraphic.GetLink().GetType();
if ( eType == GFX_LINK_TYPE_NATIVE_JPG && mParaRects.size() >= 2 )
{
mbGroupIgnoreGDIMtfActions =
rOutDevData.HasAdequateCompression( rOutDevData.HasAdequateCompression(
rGraphic, mParaRects[0], mParaRects[1]); rGraphic, mParaRects[0], mParaRects[1]);
if ( !mbGroupIgnoreGDIMtfActions ) if ( !mbGroupIgnoreGDIMtfActions )
mCurrentGraphic = rGraphic;
}
else if ( eType == GFX_LINK_TYPE_NATIVE_PNG )
{
mCurrentGraphic = rGraphic; mCurrentGraphic = rGraphic;
}
} }
break; break;
} }
......
...@@ -96,7 +96,13 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz ...@@ -96,7 +96,13 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
aBitmapEx.Mirror( nMirrorFlags ); 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 ) if( i_rContext.m_nMaxImageResolution > 50 )
{ {
...@@ -154,7 +160,7 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz ...@@ -154,7 +160,7 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
aBitmapEx.Convert( eConv ); aBitmapEx.Convert( eConv );
} }
bool bUseJPGCompression = !i_rContext.m_bOnlyLosslessCompression; bool bUseJPGCompression = !i_rContext.m_bOnlyLosslessCompression;
if ( ( aSizePixel.Width() < 32 ) || ( aSizePixel.Height() < 32 ) ) if ( bIsPng || ( aSizePixel.Width() < 32 ) || ( aSizePixel.Height() < 32 ) )
bUseJPGCompression = false; bUseJPGCompression = false;
SvMemoryStream aStrm; SvMemoryStream aStrm;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment