diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2016-02-13 16:08:01 +1100 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2016-02-17 20:11:28 +0000 |
commit | a93f7792af5a8ce53ef1dc57380624476e14f933 (patch) | |
tree | 98923db2af7d0e325ec2363d29d833f55c05591a /filter | |
parent | 398fcdd3abcab3dbd0418dbae87ed4ca7451315c (diff) |
tdf#85761 vcl: JPEG export does not save PPI values correctly
JPEG values are currently hardcoded to 96PPI when we export JPEGs. The
Graphic class doesn't have an easy way to get the PPI, but this can
actually be calculated from the pref size and pref map mode (no idea
why it is called "Pref").
Interestingly, you need to get a multiplier to work this out, relative
to units of 100th mm. The EPS filter code had a function that does
exactly this, but it's entirely based on MapMode units so it was really
implemented in the wrong class IMO. I have thus moved it out of PSWriter
and into MapMode.
This also fixes tdf#65695, which was partially fixed, but had the JPEG
PPI hardcoded to 96dpi.
Also fixes tdf#97481.
Change-Id: Iedb674141dd4e22fcbfb7be357dc777f732aa3aa
Reviewed-on: https://gerrit.libreoffice.org/22339
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/22380
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/graphicfilter/eps/eps.cxx | 53 |
1 files changed, 1 insertions, 52 deletions
diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index 8bc304e5ee34..ac2252cc4572 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -215,7 +215,6 @@ private: inline void ImplWriteTextColor( sal_uLong nMode = PS_RET ); void ImplWriteColor( sal_uLong nMode ); - static double ImplGetScaling( const MapMode& ); void ImplGetMapMode( const MapMode& ); static bool ImplGetBoundingBox( double* nNumb, sal_uInt8* pSource, sal_uLong nSize ); static sal_uInt8* ImplSearchEntry( sal_uInt8* pSource, sal_uInt8 const * pDest, sal_uLong nComp, sal_uLong nSize ); @@ -2306,60 +2305,10 @@ void PSWriter::ImplWriteColor( sal_uLong nMode ) ImplExecMode( nMode ); } - - -double PSWriter::ImplGetScaling( const MapMode& rMapMode ) -{ - double nMul; - switch ( rMapMode.GetMapUnit() ) - { - case MAP_PIXEL : - case MAP_SYSFONT : - case MAP_APPFONT : - - case MAP_100TH_MM : - nMul = 1; - break; - case MAP_10TH_MM : - nMul = 10; - break; - case MAP_MM : - nMul = 100; - break; - case MAP_CM : - nMul = 1000; - break; - case MAP_1000TH_INCH : - nMul = 2.54; - break; - case MAP_100TH_INCH : - nMul = 25.4; - break; - case MAP_10TH_INCH : - nMul = 254; - break; - case MAP_INCH : - nMul = 2540; - break; - case MAP_TWIP : - nMul = 1.76388889; - break; - case MAP_POINT : - nMul = 35.27777778; - break; - default: - nMul = 1.0; - break; - } - return nMul; -} - - - void PSWriter::ImplGetMapMode( const MapMode& rMapMode ) { ImplWriteLine( "tm setmatrix" ); - double fMul = ImplGetScaling( rMapMode ); + double fMul = rMapMode.GetUnitMultiplier(); double fScaleX = (double)rMapMode.GetScaleX() * fMul; double fScaleY = (double)rMapMode.GetScaleY() * fMul; ImplTranslate( rMapMode.GetOrigin().X() * fScaleX, rMapMode.GetOrigin().Y() * fScaleY ); |