summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorMarkus Mohrhard <markus.mohrhard@collabora.co.uk>2014-02-20 02:30:39 +0100
committerMarkus Mohrhard <markus.mohrhard@googlemail.com>2014-02-20 04:26:47 +0100
commitcf0028eaf6c8f09a4f5753005d65505ea9135246 (patch)
treee8baac20ba786590de1ca3ed9272ed3c151b5143 /vcl
parent38f9952a7d7f622b22dad653a174c885ad91f1a7 (diff)
reduce scope of many variables
Change-Id: Id401a0414f650fb2ee14d895d261f9e38cd104b0
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/bitmap3.cxx47
1 files changed, 23 insertions, 24 deletions
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 16e884893df2..1c01f093f9b4 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -1329,7 +1329,7 @@ sal_Bool Bitmap::ImplScaleSuper(
if( bHMirr )
fTemp = nTempX - fTemp;
pMapIX[ nX ] = MinMax( (long) fTemp, 0, nTemp );
- pMapFX[ nX ] = (long) ( ( fTemp - pMapIX ) * 128. );
+ pMapFX[ nX ] = (long) ( ( fTemp - pMapIX[nX] ) * 128. );
}
// create vertical mapping table
@@ -1349,13 +1349,11 @@ sal_Bool Bitmap::ImplScaleSuper(
{
if( scaleX >= fScaleThresh && scaleY >= fScaleThresh )
{
- Scanline pLine0, pLine1;
-
for( nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
{
nTempY = pMapIY[ nY ]; nTempFY = pMapFY[ nY ];
- pLine0 = pAcc->GetScanline( nTempY );
- pLine1 = pAcc->GetScanline( ++nTempY );
+ Scanline pLine0 = pAcc->GetScanline( nTempY );
+ Scanline pLine1 = pAcc->GetScanline( ++nTempY );
for( nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ )
{
@@ -1383,17 +1381,13 @@ sal_Bool Bitmap::ImplScaleSuper(
}
else
{
- Scanline pTmpY;
- long nSumR, nSumG, nSumB,nLineStart , nLineRange, nRowStart , nRowRange ;
- long nLeft, nRight, nTop, nBottom, nWeightX, nWeightY ;
- long nSumRowR ,nSumRowG,nSumRowB, nTotalWeightX, nTotalWeightY;
-
for( nY = nStartY , nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
{
- nTop = bVMirr ? ( nY + 1 ) : nY;
- nBottom = bVMirr ? nY : ( nY + 1 ) ;
+ long nTop = bVMirr ? ( nY + 1 ) : nY;
+ long nBottom = bVMirr ? nY : ( nY + 1 ) ;
- if( nY ==nEndY )
+ long nLineStart, nLineRange;
+ if( nY == nEndY )
{
nLineStart = pMapIY[ nY ];
nLineRange = 0;
@@ -1406,9 +1400,11 @@ sal_Bool Bitmap::ImplScaleSuper(
for( nX = nStartX , nXDst = 0L; nX <= nEndX; nX++ )
{
- nLeft = bHMirr ? ( nX + 1 ) : nX;
- nRight = bHMirr ? nX : ( nX + 1 ) ;
+ long nLeft = bHMirr ? ( nX + 1 ) : nX;
+ long nRight = bHMirr ? nX : ( nX + 1 ) ;
+ long nRowStart;
+ long nRowRange;
if( nX == nEndX )
{
nRowStart = pMapIX[ nX ];
@@ -1420,14 +1416,18 @@ sal_Bool Bitmap::ImplScaleSuper(
nRowRange = ( pMapIX[ nRight ] == pMapIX[ nLeft ] )? 1 : ( pMapIX[ nRight ] - pMapIX[ nLeft ] );
}
- nSumR = nSumG = nSumB = 0;
- nTotalWeightY = 0;
+ long nSumR = 0;
+ long nSumG = 0;
+ long nSumB = 0;
+ long nTotalWeightY = 0;
for(int i = 0; i<= nLineRange; i++)
{
- pTmpY = pAcc->GetScanline( nLineStart + i );
- nSumRowR = nSumRowG = nSumRowB = 0;
- nTotalWeightX = 0;
+ Scanline pTmpY = pAcc->GetScanline( nLineStart + i );
+ long nSumRowR = 0;
+ long nSumRowG = 0;
+ long nSumRowB = 0;
+ long nTotalWeightX = 0;
for(int j = 0; j <= nRowRange; j++)
{
@@ -1442,7 +1442,7 @@ sal_Bool Bitmap::ImplScaleSuper(
}
else if( j == 0 )
{
- nWeightX = (nMax- pMapFX[ nLeft ]) ;
+ long nWeightX = (nMax- pMapFX[ nLeft ]) ;
nSumRowB += ( nWeightX *rCol.GetBlue()) ;
nSumRowG += ( nWeightX *rCol.GetGreen()) ;
nSumRowR += ( nWeightX *rCol.GetRed()) ;
@@ -1450,7 +1450,7 @@ sal_Bool Bitmap::ImplScaleSuper(
}
else if ( nRowRange == j )
{
- nWeightX = pMapFX[ nRight ] ;
+ long nWeightX = pMapFX[ nRight ] ;
nSumRowB += ( nWeightX *rCol.GetBlue() );
nSumRowG += ( nWeightX *rCol.GetGreen() );
nSumRowR += ( nWeightX *rCol.GetRed() );
@@ -1465,6 +1465,7 @@ sal_Bool Bitmap::ImplScaleSuper(
}
}
+ long nWeightY = nMax;
if( nY == nEndY )
nWeightY = nMax;
else if( i == 0 )
@@ -1473,8 +1474,6 @@ sal_Bool Bitmap::ImplScaleSuper(
nWeightY = pMapFY[ nTop ];
else if ( nLineRange == i )
nWeightY = pMapFY[ nBottom ];
- else
- nWeightY = nMax;
nSumB += nWeightY * ( nSumRowB / nTotalWeightX );
nSumG += nWeightY * ( nSumRowG / nTotalWeightX );