diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-02-20 03:40:19 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2014-02-20 04:26:48 +0100 |
commit | 28038998856e8c61f018b985452bbff13aa5c6e6 (patch) | |
tree | 5e029c8894fa51fe99859a45c19737684c08e295 | |
parent | fa395e689e22d6bc49785bdf688057546ea27f62 (diff) |
reduce scope
Change-Id: I7e296a0983a1d4e3a7501333cfd3cdf7c561383c
-rw-r--r-- | vcl/source/gdi/bitmap3.cxx | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx index d915fe504000..8015942b2efc 100644 --- a/vcl/source/gdi/bitmap3.cxx +++ b/vcl/source/gdi/bitmap3.cxx @@ -1482,7 +1482,6 @@ sal_Bool Bitmap::ImplScaleSuper( ( sal_uInt8 ) (( nSumG / nTotalWeightY) ), ( sal_uInt8 ) (( nSumB / nTotalWeightY) ) ); pWAcc->SetPixel( nYDst, nXDst++, aColRes ); - } } } @@ -1523,15 +1522,12 @@ sal_Bool Bitmap::ImplScaleSuper( } else { - long nSumR, nSumG, nSumB,nLineStart , nLineRange, nRowStart , nRowRange ; - long nLeft, nRight, nWeightX, nWeightY ; - long nSumRowR ,nSumRowG,nSumRowB, nTotalWeightX, nTotalWeightY; - for( long nY = nStartY , nYDst = 0L; nY <= nEndY; nY++, nYDst++ ) { long nTop = bVMirr ? ( nY + 1 ) : nY; long nBottom = bVMirr ? nY : ( nY + 1 ) ; + long nLineStart, nLineRange; if( nY ==nEndY ) { nLineStart = pMapIY[ nY ]; @@ -1545,9 +1541,10 @@ sal_Bool Bitmap::ImplScaleSuper( for( long 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, nRowRange; if( nX == nEndX ) { nRowStart = pMapIX[ nX ]; @@ -1559,13 +1556,17 @@ 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++) { - nSumRowR = nSumRowG = nSumRowB = 0; - nTotalWeightX = 0; + long nSumRowR = 0; + long nSumRowG = 0; + long nSumRowB = 0; + long nTotalWeightX = 0; for(int j = 0; j <= nRowRange; j++) { @@ -1582,7 +1583,7 @@ sal_Bool Bitmap::ImplScaleSuper( else if( j == 0 ) { - nWeightX = (nMax- pMapFX[ nLeft ]) ; + long nWeightX = (nMax- pMapFX[ nLeft ]) ; nSumRowB += ( nWeightX *aCol0.GetBlue()) ; nSumRowG += ( nWeightX *aCol0.GetGreen()) ; nSumRowR += ( nWeightX *aCol0.GetRed()) ; @@ -1591,7 +1592,7 @@ sal_Bool Bitmap::ImplScaleSuper( else if ( nRowRange == j ) { - nWeightX = pMapFX[ nRight ] ; + long nWeightX = pMapFX[ nRight ] ; nSumRowB += ( nWeightX *aCol0.GetBlue() ); nSumRowG += ( nWeightX *aCol0.GetGreen() ); nSumRowR += ( nWeightX *aCol0.GetRed() ); @@ -1607,6 +1608,7 @@ sal_Bool Bitmap::ImplScaleSuper( } } + long nWeightY = nMax; if( nY == nEndY ) nWeightY = nMax; else if( i == 0 ) @@ -1615,8 +1617,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 ); @@ -1639,22 +1639,20 @@ sal_Bool Bitmap::ImplScaleSuper( { if( scaleX >= fScaleThresh && scaleY >= fScaleThresh ) { - Scanline pLine0, pLine1, pTmp0, pTmp1; - long nOff; - for( long nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ ) { long nTempY = pMapIY[ nY ]; long nTempFY = pMapFY[ nY ]; - pLine0 = pAcc->GetScanline( nTempY ); - pLine1 = pAcc->GetScanline( ++nTempY ); + Scanline pLine0 = pAcc->GetScanline( nTempY ); + Scanline pLine1 = pAcc->GetScanline( ++nTempY ); for( long nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ ) { - nOff = 3L * pMapIX[ nX ]; + long nOff = 3L * pMapIX[ nX ]; long nTempFX = pMapFX[ nX ]; - pTmp1 = ( pTmp0 = pLine0 + nOff ) + 3L; + Scanline pTmp0 = pLine0 + nOff ; + Scanline pTmp1 = pTmp0 + 3L; sal_uInt8 cB0 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++; sal_uInt8 cG0 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++; sal_uInt8 cR0 = MAP( *pTmp0, *pTmp1, nTempFX ); @@ -1673,16 +1671,13 @@ sal_Bool Bitmap::ImplScaleSuper( } else { - Scanline pTmpY, pTmpX; - long nSumR, nSumG, nSumB,nLineStart , nLineRange, nRowStart , nRowRange ; - long nLeft, nRight, nTop, nBottom, nWeightX, nWeightY ; - long nSumRowR ,nSumRowG,nSumRowB, nTotalWeightX, nTotalWeightY; - for( long 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 ) ; + long nLineStart; + long nLineRange; if( nY ==nEndY ) { nLineStart = pMapIY[ nY ]; @@ -1696,9 +1691,11 @@ sal_Bool Bitmap::ImplScaleSuper( for( long 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 ]; @@ -1710,15 +1707,19 @@ 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 ); - pTmpX = pTmpY + 3L * nRowStart; - nSumRowR = nSumRowG = nSumRowB = 0; - nTotalWeightX = 0; + Scanline pTmpY = pAcc->GetScanline( nLineStart + i ); + Scanline pTmpX = pTmpY + 3L * nRowStart; + long nSumRowR = 0; + long nSumRowG = 0; + long nSumRowB = 0; + long nTotalWeightX = 0; for(int j = 0; j <= nRowRange; j++) { @@ -1731,7 +1732,7 @@ sal_Bool Bitmap::ImplScaleSuper( } else if( j == 0 ) { - nWeightX = (nMax- pMapFX[ nLeft ]) ; + long nWeightX = (nMax- pMapFX[ nLeft ]) ; nSumRowB += ( nWeightX *( *pTmpX )) ;pTmpX++; nSumRowG += ( nWeightX *( *pTmpX )) ;pTmpX++; nSumRowR += ( nWeightX *( *pTmpX )) ;pTmpX++; @@ -1739,7 +1740,7 @@ sal_Bool Bitmap::ImplScaleSuper( } else if ( nRowRange == j ) { - nWeightX = pMapFX[ nRight ] ; + long nWeightX = pMapFX[ nRight ] ; nSumRowB += ( nWeightX *( *pTmpX ) );pTmpX++; nSumRowG += ( nWeightX *( *pTmpX ) );pTmpX++; nSumRowR += ( nWeightX *( *pTmpX ) );pTmpX++; @@ -1754,6 +1755,7 @@ sal_Bool Bitmap::ImplScaleSuper( } } + long nWeightY = nMax; if( nY == nEndY ) nWeightY = nMax; else if( i == 0 ) @@ -1762,8 +1764,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 ); |