About this commit:
--- a/sd/source/ui/dlg/docprev.cxx
+++ b/sd/source/ui/dlg/docprev.cxx
@@ -87,7 +87,7 @@ void SdDocPreviewWin::CalcSizeAndPos( GDIMetaFile* pFile, Size& rSize, Point& rP
void SdDocPreviewWin::CalcSizeAndPos( GDIMetaFile* pFile, Size& rSize, Point& rPoint )
{
Size aTmpSize = pFile ? pFile->GetPrefSize() : Size(1,1 );
long nWidth = rSize.Width() - 2*FRAME;
long nHeight = rSize.Height() - 2*FRAME;
if( nWidth < 0 ) nWidth = 0;
- if( nHeight < 0 ) nHeight = 0;
+ if( nHeight < 0 ) nHeight = 1;
double dRatio=((double)aTmpSize.Width())/aTmpSize.Height();
double dRatioPreV=((double) nWidth ) / nHeight;
if (dRatio>dRatioPreV)
{
rSize=Size(nWidth, (sal_uInt16)(nWidth/dRatio));
rPoint=Point( 0, (sal_uInt16)((nHeight-rSize.Height())/2));
}
else
{
rSize=Size((sal_uInt16)(nHeight*dRatio), nHeight);
rPoint=Point((sal_uInt16)((nWidth-rSize.Width())/2),0);
}
}
I wonder if we should not rather do something like:
double dRatioPreV;
if( nHeight < 0 )
{
nHeight = 0;
dRatioPreV = 1; // or rather zero? or +infinity? Do we want to
// "force" a branch of the next if/else?
}
else
dRatioPreV = ((double) nWidth ) / nHeight;
Anybody has a good idea, preferably based on an understanding of what
this function does?
--
Lionel
Context
- avoiding cppunit zerodiv correction · Lionel Elie Mamane
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.