[Libreoffice-commits] core.git: sfx2/source
Julien Nabet
serval2412 at yahoo.fr
Mon Mar 24 12:53:46 PDT 2014
sfx2/source/doc/new.cxx | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
New commits:
commit 59475ae16329edd32d286eb912c3f52d3395c818
Author: Julien Nabet <serval2412 at yahoo.fr>
Date: Mon Mar 24 20:47:43 2014 +0100
cppcheck: fix Division by zero + move some lines
See http://nabble.documentfoundation.org/Cppcheck-reports-quot-Division-by-zero-quot-in-new-cxx-sfx2-module-td4102613.html
Change-Id: I71433bcb20575016ee2e993a67c6e09646672f9b
diff --git a/sfx2/source/doc/new.cxx b/sfx2/source/doc/new.cxx
index d8bbd51..04b1200 100644
--- a/sfx2/source/doc/new.cxx
+++ b/sfx2/source/doc/new.cxx
@@ -68,14 +68,19 @@ Size SfxPreviewBase_Impl::GetOptimalSize() const
void SfxPreviewWin_Impl::ImpPaint(
const Rectangle&, GDIMetaFile* pFile, Window* pWindow )
{
+ pWindow->SetLineColor();
+ Color aLightGrayCol( COL_LIGHTGRAY );
+ pWindow->SetFillColor( aLightGrayCol );
+ pWindow->DrawRect( Rectangle( Point( 0,0 ), pWindow->GetOutputSize() ) );
+
Size aTmpSize = pFile ? pFile->GetPrefSize() : Size(1,1 );
DBG_ASSERT( aTmpSize.Height()*aTmpSize.Width(),
"size of first page is 0, overload GetFirstPageSize or set vis-area!" );
#define FRAME 4
long nWidth = pWindow->GetOutputSize().Width() - 2*FRAME;
long nHeight = pWindow->GetOutputSize().Height() - 2*FRAME;
- if( nWidth < 0 ) nWidth = 0;
- if( nHeight < 0 ) nHeight = 0;
+ if (nWidth <= 0 || nHeight <= 0)
+ return;
double dRatio=((double)aTmpSize.Width())/aTmpSize.Height();
double dRatioPreV=((double) nWidth ) / nHeight;
@@ -93,11 +98,6 @@ void SfxPreviewWin_Impl::ImpPaint(
}
Point bPoint=Point(nWidth,nHeight)-aPoint;
-
- pWindow->SetLineColor();
- Color aLightGrayCol( COL_LIGHTGRAY );
- pWindow->SetFillColor( aLightGrayCol );
- pWindow->DrawRect( Rectangle( Point( 0,0 ), pWindow->GetOutputSize() ) );
if ( pFile )
{
Color aBlackCol( COL_BLACK );
More information about the Libreoffice-commits
mailing list