From 14e326516512e3999ca3f7217e5b2a0f1730ca35 Mon Sep 17 00:00:00 2001 From: Tomaž Vajngerl Date: Thu, 15 May 2014 13:52:21 +0200 Subject: fdo#78603 mixup (Left->Top) in Rectangle construction Conflicts: vcl/source/filter/wmf/winwmf.cxx Change-Id: I7fa566e036508d43b153c7983dc89fc6660718e7 --- vcl/source/filter/wmf/winwmf.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'vcl') diff --git a/vcl/source/filter/wmf/winwmf.cxx b/vcl/source/filter/wmf/winwmf.cxx index e02606e20b8c..6438b8f9ce9e 100644 --- a/vcl/source/filter/wmf/winwmf.cxx +++ b/vcl/source/filter/wmf/winwmf.cxx @@ -1152,6 +1152,21 @@ sal_Bool WMFReader::ReadHeader() { pWMF->Seek( nStrmPos + 18 ); // set the streampos to the start of the metaactions GetPlaceableBound( aPlaceableBound, pWMF ); + + // The image size is not known so normalize the calculated bounds so that the + // resulting image is not too big + const long aMaxWidth = 1024; + const double fMaxWidth = static_cast(aMaxWidth); + if (aPlaceableBound.GetWidth() > aMaxWidth) + { + double fRatio = aPlaceableBound.GetWidth() / fMaxWidth; + + aPlaceableBound = Rectangle( + aPlaceableBound.Left() / fRatio, + aPlaceableBound.Top() / fRatio, + aPlaceableBound.Right() / fRatio, + aPlaceableBound.Bottom() / fRatio); + } } pWMF->Seek( nStrmPos ); -- cgit v1.2.3