This patch should fix the cppcheck style warnings for grfmgr.cxx: core/svtools/source/graphic/grfmgr.cxx 278 variableScope style The scope of the variable 'nNewLeft' can be reduced 278 variableScope style The scope of the variable 'nNewTop' can be reduced 278 variableScope style The scope of the variable 'nNewRight' can be reduced 278 variableScope style The scope of the variable 'nNewBottom' can be reduced 279 variableScope style The scope of the variable 'fScale' can be reduced
patch is released under LGPLv3. -- Kenneth
diff --git a/svtools/source/graphic/grfmgr.cxx b/svtools/source/graphic/grfmgr.cxx index 43b8687..4e3d994 100644 --- a/svtools/source/graphic/grfmgr.cxx +++ b/svtools/source/graphic/grfmgr.cxx @@ -275,8 +275,6 @@ sal_Bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& const MapMode aMap100( MAP_100TH_MM ); Size aSize100; long nTotalWidth, nTotalHeight; - long nNewLeft, nNewTop, nNewRight, nNewBottom; - double fScale; if( nRot10 ) { @@ -301,17 +299,17 @@ sal_Bool GraphicObject::ImplGetCropParams( OutputDevice* pOut, Point& rPt, Size& if( aSize100.Width() > 0 && aSize100.Height() > 0 && nTotalWidth > 0 && nTotalHeight > 0 ) { - fScale = (double) aSize100.Width() / nTotalWidth; - nNewLeft = -FRound( ( ( pAttr->GetMirrorFlags() & BMP_MIRROR_HORZ ) ? pAttr->GetRightCrop() : pAttr->GetLeftCrop() ) * fScale ); - nNewRight = nNewLeft + FRound( aSize100.Width() * fScale ) - 1; + double fScale = (double) aSize100.Width() / nTotalWidth; + const long nNewLeft = -FRound( ( ( pAttr->GetMirrorFlags() & BMP_MIRROR_HORZ ) ? pAttr->GetRightCrop() : pAttr->GetLeftCrop() ) * fScale ); + const long nNewRight = nNewLeft + FRound( aSize100.Width() * fScale ) - 1; fScale = (double) rSz.Width() / aSize100.Width(); rPt.X() += FRound( nNewLeft * fScale ); rSz.Width() = FRound( ( nNewRight - nNewLeft + 1 ) * fScale ); fScale = (double) aSize100.Height() / nTotalHeight; - nNewTop = -FRound( ( ( pAttr->GetMirrorFlags() & BMP_MIRROR_VERT ) ? pAttr->GetBottomCrop() : pAttr->GetTopCrop() ) * fScale ); - nNewBottom = nNewTop + FRound( aSize100.Height() * fScale ) - 1; + const long nNewTop = -FRound( ( ( pAttr->GetMirrorFlags() & BMP_MIRROR_VERT ) ? pAttr->GetBottomCrop() : pAttr->GetTopCrop() ) * fScale ); + const long nNewBottom = nNewTop + FRound( aSize100.Height() * fScale ) - 1; fScale = (double) rSz.Height() / aSize100.Height(); rPt.Y() += FRound( nNewTop * fScale );
_______________________________________________ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice