diff options
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/filter/graphicfilter2.cxx | 17 | ||||
-rw-r--r-- | vcl/source/gdi/impgraph.cxx | 7 |
2 files changed, 23 insertions, 1 deletions
diff --git a/vcl/source/filter/graphicfilter2.cxx b/vcl/source/filter/graphicfilter2.cxx index a40e54002cff..2b66d2d29395 100644 --- a/vcl/source/filter/graphicfilter2.cxx +++ b/vcl/source/filter/graphicfilter2.cxx @@ -156,13 +156,21 @@ bool GraphicDescriptor::ImpDetectBMP( SvStream& rStm, bool bExtendedInfo ) // logical width rStm.SeekRel( 4 ); rStm.ReadUInt32( nTemp32 ); + sal_uInt32 nXPelsPerMeter = 0; if ( nTemp32 ) + { aLogSize.setWidth( ( aPixSize.Width() * 100000 ) / nTemp32 ); + nXPelsPerMeter = nTemp32; + } // logical height rStm.ReadUInt32( nTemp32 ); + sal_uInt32 nYPelsPerMeter = 0; if ( nTemp32 ) + { aLogSize.setHeight( ( aPixSize.Height() * 100000 ) / nTemp32 ); + nYPelsPerMeter = nTemp32; + } // further validation, check for rational values if ( ( nBitsPerPixel > 24 ) || ( nCompression > 3 ) ) @@ -170,6 +178,15 @@ bool GraphicDescriptor::ImpDetectBMP( SvStream& rStm, bool bExtendedInfo ) nFormat = GraphicFileFormat::NOT; bRet = false; } + + if (bRet && nXPelsPerMeter && nYPelsPerMeter) + { + maPreferredMapMode + = MapMode(MapUnit::MapMM, Point(), Fraction(1000, nXPelsPerMeter), + Fraction(1000, nYPelsPerMeter)); + + maPreferredLogSize = Size(aPixSize.getWidth(), aPixSize.getHeight()); + } } } rStm.Seek( nStmPos ); diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx index 6d10f7268e38..e16e12b0ef5b 100644 --- a/vcl/source/gdi/impgraph.cxx +++ b/vcl/source/gdi/impgraph.cxx @@ -397,7 +397,12 @@ void ImpGraphic::setPrepared(bool bAnimated, const Size* pSizeHint) // conversion will work with the output device DPI, not the graphic // DPI. Size aLogSize = aDescriptor.GetSize_100TH_MM(); - if (aLogSize.getWidth() && aLogSize.getHeight()) + if (aDescriptor.GetPreferredLogSize() && aDescriptor.GetPreferredMapMode()) + { + maSwapInfo.maPrefSize = *aDescriptor.GetPreferredLogSize(); + maSwapInfo.maPrefMapMode = *aDescriptor.GetPreferredMapMode(); + } + else if (aLogSize.getWidth() && aLogSize.getHeight()) { maSwapInfo.maPrefSize = aLogSize; maSwapInfo.maPrefMapMode = MapMode(MapUnit::Map100thMM); |