[Libreoffice-commits] core.git: Branch 'feature/fixes27' - include/vcl vcl/source
László Németh
laszlo.nemeth at collabora.com
Fri Jul 22 16:06:27 UTC 2016
include/vcl/pdfextoutdevdata.hxx | 2 -
vcl/source/gdi/pdfextoutdevdata.cxx | 27 ++++------------------
vcl/source/gdi/pdfwriter_impl.hxx | 2 -
vcl/source/gdi/pdfwriter_impl2.cxx | 44 +++++++++---------------------------
4 files changed, 18 insertions(+), 57 deletions(-)
New commits:
commit d9873699ee5f908dd8d640e07ebe1aefdfb9f062
Author: László Németh <laszlo.nemeth at collabora.com>
Date: Fri Jul 22 18:04:23 2016 +0200
Revert "tdf#97662 - Try to preserve original compressed JPEGs harder."
This reverts commit 2ee228e179d98630bc69cef8b13a55c0edbe9e1b.
diff --git a/include/vcl/pdfextoutdevdata.hxx b/include/vcl/pdfextoutdevdata.hxx
index 1140180..477f668 100644
--- a/include/vcl/pdfextoutdevdata.hxx
+++ b/include/vcl/pdfextoutdevdata.hxx
@@ -146,8 +146,6 @@ public:
std::vector< PDFExtOutDevBookmarkEntry >& GetBookmarks() { return maBookmarks;}
- Graphic GetCurrentGraphic() const;
-
/** Start a new group of render output
Use this method to group render output.
diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx
index 75ce7de..1e3007c 100644
--- a/vcl/source/gdi/pdfextoutdevdata.cxx
+++ b/vcl/source/gdi/pdfextoutdevdata.cxx
@@ -294,17 +294,13 @@ struct PageSyncData
std::deque< PDFWriter::StructAttribute > mParaStructAttributes;
std::deque< PDFWriter::StructAttributeValue > mParaStructAttributeValues;
std::deque< Graphic > mGraphics;
- Graphic mCurrentGraphic;
std::deque< std::shared_ptr< PDFWriter::AnyWidget > >
mControls;
GlobalSyncData* mpGlobalData;
bool mbGroupIgnoreGDIMtfActions;
-
- explicit PageSyncData( GlobalSyncData* pGlobal )
- : mbGroupIgnoreGDIMtfActions ( false )
- { mpGlobalData = pGlobal; }
+ explicit PageSyncData( GlobalSyncData* pGlobal ) : mbGroupIgnoreGDIMtfActions ( false ) { mpGlobalData = pGlobal; }
void PushAction( const OutputDevice& rOutDev, const PDFExtOutDevDataSync::Action eAct );
bool PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAction, const PDFExtOutDevData& rOutDevData );
@@ -407,19 +403,12 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc
}
else if ( aBeg->eAct == PDFExtOutDevDataSync::EndGroupGfxLink )
{
- Graphic& rGraphic = mGraphics.front();
- if ( rGraphic.IsLink() )
+ if ( rOutDevData.GetIsLosslessCompression() && !rOutDevData.GetIsReduceImageResolution() )
{
- GfxLinkType eType = rGraphic.GetLink().GetType();
- if ( eType == GFX_LINK_TYPE_NATIVE_JPG )
- {
- mbGroupIgnoreGDIMtfActions = rOutDevData.GetIsLosslessCompression() && !rOutDevData.GetIsReduceImageResolution();
- if ( !mbGroupIgnoreGDIMtfActions )
- mCurrentGraphic = rGraphic;
- }
- else if ( eType == GFX_LINK_TYPE_NATIVE_PNG )
+ Graphic& rGraphic = mGraphics.front();
+ if ( rGraphic.IsLink() && rGraphic.GetLink().GetType() == GFX_LINK_TYPE_NATIVE_JPG )
{
- mCurrentGraphic = rGraphic;
+ mbGroupIgnoreGDIMtfActions = true;
}
}
break;
@@ -475,7 +464,6 @@ bool PageSyncData::PlaySyncPageAct( PDFWriter& rWriter, sal_uInt32& rCurGDIMtfAc
}
mbGroupIgnoreGDIMtfActions = false;
}
- mCurrentGraphic.Clear();
}
break;
case PDFExtOutDevDataSync::CreateNamedDest:
@@ -528,11 +516,6 @@ PDFExtOutDevData::~PDFExtOutDevData()
delete mpGlobalSyncData;
}
-Graphic PDFExtOutDevData::GetCurrentGraphic() const
-{
- return mpPageSyncData->mCurrentGraphic;
-}
-
void PDFExtOutDevData::SetDocumentLocale( const css::lang::Locale& rLoc )
{
maDocLocale = rLoc;
diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx
index 306bb15..77b0d47 100644
--- a/vcl/source/gdi/pdfwriter_impl.hxx
+++ b/vcl/source/gdi/pdfwriter_impl.hxx
@@ -1011,7 +1011,7 @@ i12626
// helper for playMetafile
void implWriteGradient( const tools::PolyPolygon& rPolyPoly, const Gradient& rGradient,
VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& );
- void implWriteBitmapEx( const Point& rPoint, const Size& rSize, const BitmapEx& rBitmapEx, Graphic i_pGraphic,
+ void implWriteBitmapEx( const Point& rPoint, const Size& rSize, const BitmapEx& rBitmapEx,
VirtualDevice* pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& );
// helpers for CCITT 1bit bitmap stream
diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx
index aede71a..9af537a 100644
--- a/vcl/source/gdi/pdfwriter_impl2.cxx
+++ b/vcl/source/gdi/pdfwriter_impl2.cxx
@@ -65,7 +65,7 @@ void PDFWriterImpl::implWriteGradient( const tools::PolyPolygon& i_rPolyPoly, co
m_rOuterFace.Pop();
}
-void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSize, const BitmapEx& i_rBitmapEx, Graphic i_Graphic,
+void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSize, const BitmapEx& i_rBitmapEx,
VirtualDevice* i_pDummyVDev, const vcl::PDFWriter::PlayMetafileContext& i_rContext )
{
if ( !i_rBitmapEx.IsEmpty() && i_rSize.Width() && i_rSize.Height() )
@@ -95,15 +95,6 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
{
aBitmapEx.Mirror( nMirrorFlags );
}
-
- 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 )
{
// do downsampling if necessary
@@ -160,7 +151,7 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
aBitmapEx.Convert( eConv );
}
bool bUseJPGCompression = !i_rContext.m_bOnlyLosslessCompression;
- if ( bIsPng || ( aSizePixel.Width() < 32 ) || ( aSizePixel.Height() < 32 ) )
+ if ( ( aSizePixel.Width() < 32 ) || ( aSizePixel.Height() < 32 ) )
bUseJPGCompression = false;
SvMemoryStream aStrm;
@@ -169,10 +160,8 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
bool bTrueColorJPG = true;
if ( bUseJPGCompression )
{
-
- sal_uInt32 nZippedFileSize = 0; // sj: we will calculate the filesize of a zipped bitmap
- if ( !bIsJpeg ) // to determine if jpeg compression is useful
- {
+ sal_uInt32 nZippedFileSize; // sj: we will calculate the filesize of a zipped bitmap
+ { // to determine if jpeg compression is useful
SvMemoryStream aTemp;
aTemp.SetCompressMode( aTemp.GetCompressMode() | SvStreamCompressFlags::ZBITMAP );
aTemp.SetVersion( SOFFICE_FILEFORMAT_40 ); // sj: up from version 40 our bitmap stream operator
@@ -214,7 +203,7 @@ void PDFWriterImpl::implWriteBitmapEx( const Point& i_rPoint, const Size& i_rSiz
aOutMediaProperties[2].Value <<= aFilterData;
xGraphicProvider->storeGraphic( xGraphic, aOutMediaProperties );
xOut->flush();
- if ( !bIsJpeg && xSeekable->getLength() > nZippedFileSize )
+ if ( xSeekable->getLength() > nZippedFileSize )
{
bUseJPGCompression = false;
}
@@ -493,9 +482,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
xVDev->EnableMapMode( false );
xVDev->DrawMask( aPoint, aDstSizePixel, aMask, Color( COL_WHITE ) );
aAlpha = xVDev->GetBitmap( aPoint, aDstSizePixel );
-
- Graphic aGraphic = i_pOutDevData ? i_pOutDevData->GetCurrentGraphic() : Graphic();
- implWriteBitmapEx( rPos, rSize, BitmapEx( aPaint, aAlpha ), aGraphic, pDummyVDev, i_rContext );
+ implWriteBitmapEx( rPos, rSize, BitmapEx( aPaint, aAlpha ), pDummyVDev, i_rContext );
}
}
}
@@ -794,17 +781,14 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
aBitmapEx.GetPrefMapMode(), pDummyVDev->GetMapMode() ) );
if( ! ( aSize.Width() && aSize.Height() ) )
aSize = pDummyVDev->PixelToLogic( aBitmapEx.GetSizePixel() );
-
- Graphic aGraphic = i_pOutDevData ? i_pOutDevData->GetCurrentGraphic() : Graphic();
- implWriteBitmapEx( pA->GetPoint(), aSize, aBitmapEx, aGraphic, pDummyVDev, i_rContext );
+ implWriteBitmapEx( pA->GetPoint(), aSize, aBitmapEx, pDummyVDev, i_rContext );
}
break;
case( MetaActionType::BMPSCALE ):
{
const MetaBmpScaleAction* pA = static_cast<const MetaBmpScaleAction*>(pAction);
- Graphic aGraphic = i_pOutDevData ? i_pOutDevData->GetCurrentGraphic() : Graphic();
- implWriteBitmapEx( pA->GetPoint(), pA->GetSize(), BitmapEx( pA->GetBitmap() ), aGraphic, pDummyVDev, i_rContext );
+ implWriteBitmapEx( pA->GetPoint(), pA->GetSize(), BitmapEx( pA->GetBitmap() ), pDummyVDev, i_rContext );
}
break;
@@ -813,8 +797,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
const MetaBmpScalePartAction* pA = static_cast<const MetaBmpScalePartAction*>(pAction);
BitmapEx aBitmapEx( pA->GetBitmap() );
aBitmapEx.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
- Graphic aGraphic = i_pOutDevData ? i_pOutDevData->GetCurrentGraphic() : Graphic();
- implWriteBitmapEx( pA->GetDestPoint(), pA->GetDestSize(), aBitmapEx, aGraphic, pDummyVDev, i_rContext );
+ implWriteBitmapEx( pA->GetDestPoint(), pA->GetDestSize(), aBitmapEx, pDummyVDev, i_rContext );
}
break;
@@ -824,16 +807,14 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
BitmapEx aBitmapEx( pA->GetBitmapEx() );
Size aSize( OutputDevice::LogicToLogic( aBitmapEx.GetPrefSize(),
aBitmapEx.GetPrefMapMode(), pDummyVDev->GetMapMode() ) );
- Graphic aGraphic = i_pOutDevData ? i_pOutDevData->GetCurrentGraphic() : Graphic();
- implWriteBitmapEx( pA->GetPoint(), aSize, aBitmapEx, aGraphic, pDummyVDev, i_rContext );
+ implWriteBitmapEx( pA->GetPoint(), aSize, aBitmapEx, pDummyVDev, i_rContext );
}
break;
case( MetaActionType::BMPEXSCALE ):
{
const MetaBmpExScaleAction* pA = static_cast<const MetaBmpExScaleAction*>(pAction);
- Graphic aGraphic = i_pOutDevData ? i_pOutDevData->GetCurrentGraphic() : Graphic();
- implWriteBitmapEx( pA->GetPoint(), pA->GetSize(), pA->GetBitmapEx(), aGraphic, pDummyVDev, i_rContext );
+ implWriteBitmapEx( pA->GetPoint(), pA->GetSize(), pA->GetBitmapEx(), pDummyVDev, i_rContext );
}
break;
@@ -842,8 +823,7 @@ void PDFWriterImpl::playMetafile( const GDIMetaFile& i_rMtf, vcl::PDFExtOutDevDa
const MetaBmpExScalePartAction* pA = static_cast<const MetaBmpExScalePartAction*>(pAction);
BitmapEx aBitmapEx( pA->GetBitmapEx() );
aBitmapEx.Crop( Rectangle( pA->GetSrcPoint(), pA->GetSrcSize() ) );
- Graphic aGraphic = i_pOutDevData ? i_pOutDevData->GetCurrentGraphic() : Graphic();
- implWriteBitmapEx( pA->GetDestPoint(), pA->GetDestSize(), aBitmapEx, aGraphic, pDummyVDev, i_rContext );
+ implWriteBitmapEx( pA->GetDestPoint(), pA->GetDestSize(), aBitmapEx, pDummyVDev, i_rContext );
}
break;
More information about the Libreoffice-commits
mailing list