[Libreoffice-commits] core.git: 11 commits - vcl/source

Markus Mohrhard markus.mohrhard at collabora.co.uk
Thu Feb 20 04:27:25 CET 2014


 vcl/source/gdi/bitmap3.cxx |  492 +++++++++++++++++++++------------------------
 1 file changed, 240 insertions(+), 252 deletions(-)

New commits:
commit 3234001d3fada2e4ba9ed890ffac548eba389f5a
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Feb 20 04:03:59 2014 +0100

    prefer a Scoped[Read|Write}Access
    
    Change-Id: I8ddad720685f3cbcc330b9d1f61fcf833a3d2472

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index a4fc4b4..87333ee 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -1297,9 +1297,9 @@ sal_Bool Bitmap::ImplScaleSuper(
 
     if( ( nDstW > 1L ) && ( nDstH > 1L ) )
     {
-        BitmapReadAccess*   pAcc = AcquireReadAccess();
-        Bitmap              aOutBmp( Size( nDstW, nDstH ), 24 );
-        BitmapWriteAccess*  pWAcc = aOutBmp.AcquireWriteAccess();
+        Bitmap::ScopedReadAccess pAcc(*this);
+        Bitmap aOutBmp( Size( nDstW, nDstH ), 24 );
+        Bitmap::ScopedWriteAccess pWAcc(aOutBmp);
         boost::scoped_array<long> pMapIX(new long[ nDstW ]);
         boost::scoped_array<long> pMapIY(new long[ nDstH ]);
         boost::scoped_array<long> pMapFX(new long[ nDstW ]);
@@ -2071,14 +2071,6 @@ sal_Bool Bitmap::ImplScaleSuper(
             bRet = true;
         }
 
-        if(pAcc)
-        {
-            ReleaseAccess( pAcc );
-        }
-        if(pWAcc)
-        {
-            aOutBmp.ReleaseAccess( pWAcc );
-        }
         if( bRet )
         {
             ImplAdaptBitCount(aOutBmp);
commit e6de01365989667a693546a0786f10c81ccef85c
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Feb 20 03:48:21 2014 +0100

    more scope reduction
    
    Change-Id: I5eb438ae70330990a58bc103406a0c434e53ca3f

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index ffc9d70..a4fc4b4 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -1956,15 +1956,12 @@ sal_Bool Bitmap::ImplScaleSuper(
                     }
                     else
                     {
-                        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, nLineRange;
                             if( nY ==nEndY )
                             {
                                 nLineStart = pMapIY[ nY ];
@@ -1978,9 +1975,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 ];
@@ -1992,13 +1990,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++)
                                     {
@@ -2015,7 +2017,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()) ;
@@ -2024,7 +2026,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() );
@@ -2039,6 +2041,7 @@ sal_Bool Bitmap::ImplScaleSuper(
                                         }
                                     }
 
+                                    long nWeightY = nMax;
                                     if( nY == nEndY )
                                         nWeightY = nMax;
                                     else if( i == 0 )
@@ -2047,8 +2050,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 );
commit 26be573655133ef2db6e83f1b163854f4ee22c76
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Feb 20 03:44:52 2014 +0100

    more scope reduction
    
    Change-Id: Ibfe4b4b5f9033aa0f29cf761b3a674e8c3c5f3d2

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 8015942..ffc9d70 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -1775,7 +1775,6 @@ sal_Bool Bitmap::ImplScaleSuper(
                                         ( sal_uInt8 ) (( nSumG / nTotalWeightY) ),
                                         ( sal_uInt8 ) (( nSumB / nTotalWeightY) ));
                                 pWAcc->SetPixel( nYDst, nXDst++, aColRes );
-
                             }
                         }
                     }
@@ -1784,22 +1783,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 cR0 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
                                 sal_uInt8 cG0 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
                                 sal_uInt8 cB0 = MAP( *pTmp0, *pTmp1, nTempFX );
@@ -1818,16 +1815,12 @@ 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, nLineRange;
                             if( nY ==nEndY )
                             {
                                 nLineStart = pMapIY[ nY ];
@@ -1841,9 +1834,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 ];
@@ -1855,15 +1849,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++)
                                     {
@@ -1876,7 +1874,7 @@ sal_Bool Bitmap::ImplScaleSuper(
                                         }
                                         else if( j == 0 )
                                         {
-                                            nWeightX = (nMax- pMapFX[ nLeft ]) ;
+                                            long nWeightX = (nMax- pMapFX[ nLeft ]) ;
                                             nSumRowR += ( nWeightX *( *pTmpX )) ;pTmpX++;
                                             nSumRowG += ( nWeightX *( *pTmpX )) ;pTmpX++;
                                             nSumRowB += ( nWeightX *( *pTmpX )) ;pTmpX++;
@@ -1884,7 +1882,7 @@ sal_Bool Bitmap::ImplScaleSuper(
                                         }
                                         else if ( nRowRange == j )
                                         {
-                                            nWeightX = pMapFX[ nRight ] ;
+                                            long nWeightX = pMapFX[ nRight ] ;
                                             nSumRowR += ( nWeightX *( *pTmpX ) );pTmpX++;
                                             nSumRowG += ( nWeightX *( *pTmpX ) );pTmpX++;
                                             nSumRowB += ( nWeightX *( *pTmpX ) );pTmpX++;
@@ -1899,6 +1897,7 @@ sal_Bool Bitmap::ImplScaleSuper(
                                         }
                                     }
 
+                                    long nWeightY = nMax;
                                     if( nY == nEndY )
                                         nWeightY = nMax;
                                     else if( i == 0 )
@@ -1907,8 +1906,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 );
commit 28038998856e8c61f018b985452bbff13aa5c6e6
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Feb 20 03:40:19 2014 +0100

    reduce scope
    
    Change-Id: I7e296a0983a1d4e3a7501333cfd3cdf7c561383c

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index d915fe5..8015942 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 );
commit fa395e689e22d6bc49785bdf688057546ea27f62
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Feb 20 03:30:07 2014 +0100

    more stylistic cleanup
    
    Change-Id: Ia7aea86d0bf787b851a5ecbae5b697436e1192e5

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 1a4ec18..d915fe5 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -1311,10 +1311,10 @@ sal_Bool Bitmap::ImplScaleSuper(
 
         if( pAcc && pWAcc )
         {
-            long                nW = pAcc->Width() ;
-            long                nH = pAcc->Height() ;
-            const double    fRevScaleX = ( nDstW > 1L ) ? ( (double) ( nW - 1 ) / ( nDstW - 1 ) ) : 0.0;
-            const double    fRevScaleY = ( nDstH > 1L ) ? ( (double) ( nH - 1 ) / ( nDstH - 1 ) ) : 0.0;
+            const long nW = pAcc->Width() ;
+            const long nH = pAcc->Height() ;
+            const double fRevScaleX = ( nDstW > 1L ) ? ( (double) ( nW - 1 ) / ( nDstW - 1 ) ) : 0.0;
+            const double fRevScaleY = ( nDstH > 1L ) ? ( (double) ( nH - 1 ) / ( nDstH - 1 ) ) : 0.0;
 
             // create horizontal mapping table
             for( long nX = 0L, nTempX = nW - 1L, nTemp = nW - 2L; nX < nDstW; nX++ )
commit cfe7e9d06f24c8d3b758e996455c5787771a5a45
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Feb 20 03:28:01 2014 +0100

    reduce scope for more variables
    
    Change-Id: I4b92f186bd315ced47973ea142d7e3ad8defa328

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index eae1227..1a4ec18 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -1102,8 +1102,6 @@ sal_Bool Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rSca
 
     if( ( nNewWidth > 1L ) && ( nNewHeight > 1L ) )
     {
-        BitmapColor         aCol0;
-        BitmapColor         aCol1;
         BitmapReadAccess*   pReadAcc = AcquireReadAccess();
         long                nWidth = pReadAcc->Width();
         long                nHeight = pReadAcc->Height();
@@ -1137,6 +1135,7 @@ sal_Bool Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rSca
             {
                 if( 1 == nWidth )
                 {
+                    BitmapColor aCol0;
                     if( pReadAcc->HasPalette() )
                     {
                         aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, 0 ) );
@@ -1157,6 +1156,7 @@ sal_Bool Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rSca
                     {
                         nTemp = pLutInt[ nX ];
 
+                        BitmapColor aCol0, aCol1;
                         if( pReadAcc->HasPalette() )
                         {
                             aCol0 = pReadAcc->GetPaletteColor( pReadAcc->GetPixelIndex( nY, nTemp++ ) );
@@ -1224,7 +1224,7 @@ sal_Bool Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rSca
                 {
                     if( 1 == nHeight )
                     {
-                        aCol0 = pReadAcc->GetPixel( 0, nX );
+                        BitmapColor aCol0 = pReadAcc->GetPixel( 0, nX );
 
                         for( nY = 0L; nY < nNewHeight; nY++ )
                         {
@@ -1237,8 +1237,8 @@ sal_Bool Bitmap::ImplScaleInterpolate( const double& rScaleX, const double& rSca
                         {
                             nTemp = pLutInt[ nY ];
 
-                            aCol0 = pReadAcc->GetPixel( nTemp++, nX );
-                            aCol1 = pReadAcc->GetPixel( nTemp, nX );
+                            BitmapColor aCol0 = pReadAcc->GetPixel( nTemp++, nX );
+                            BitmapColor aCol1 = pReadAcc->GetPixel( nTemp, nX );
 
                             nTemp = pLutFrac[ nY ];
 
@@ -1297,7 +1297,6 @@ sal_Bool Bitmap::ImplScaleSuper(
 
     if( ( nDstW > 1L ) && ( nDstH > 1L ) )
     {
-        BitmapColor         aCol0, aCol1, aColRes;
         BitmapReadAccess*   pAcc = AcquireReadAccess();
         Bitmap              aOutBmp( Size( nDstW, nDstH ), 24 );
         BitmapWriteAccess*  pWAcc = aOutBmp.AcquireWriteAccess();
@@ -1305,7 +1304,6 @@ sal_Bool Bitmap::ImplScaleSuper(
         boost::scoped_array<long> pMapIY(new long[ nDstH ]);
         boost::scoped_array<long> pMapFX(new long[ nDstW ]);
         boost::scoped_array<long> pMapFY(new long[ nDstH ]);
-        sal_uInt8 cR0, cG0, cB0, cR1, cG1, cB1;
         const long nStartX = 0, nStartY = 0;
         const long nEndX = nDstW - 1L;
         const long nEndY = nDstH - 1L;
@@ -1363,17 +1361,17 @@ sal_Bool Bitmap::ImplScaleSuper(
                                 const BitmapColor& rCol1 = pAcc->GetPaletteColor( pLine0[ ++nTempX ] );
                                 const BitmapColor& rCol3 = pAcc->GetPaletteColor( pLine1[ nTempX ] );
 
-                                cR0 = MAP( rCol0.GetRed(), rCol1.GetRed(), nTempFX );
-                                cG0 = MAP( rCol0.GetGreen(), rCol1.GetGreen(), nTempFX );
-                                cB0 = MAP( rCol0.GetBlue(), rCol1.GetBlue(), nTempFX );
+                                sal_uInt8 cR0 = MAP( rCol0.GetRed(), rCol1.GetRed(), nTempFX );
+                                sal_uInt8 cG0 = MAP( rCol0.GetGreen(), rCol1.GetGreen(), nTempFX );
+                                sal_uInt8 cB0 = MAP( rCol0.GetBlue(), rCol1.GetBlue(), nTempFX );
 
-                                cR1 = MAP( rCol2.GetRed(), rCol3.GetRed(), nTempFX );
-                                cG1 = MAP( rCol2.GetGreen(), rCol3.GetGreen(), nTempFX );
-                                cB1 = MAP( rCol2.GetBlue(), rCol3.GetBlue(), nTempFX );
+                                sal_uInt8 cR1 = MAP( rCol2.GetRed(), rCol3.GetRed(), nTempFX );
+                                sal_uInt8 cG1 = MAP( rCol2.GetGreen(), rCol3.GetGreen(), nTempFX );
+                                sal_uInt8 cB1 = MAP( rCol2.GetBlue(), rCol3.GetBlue(), nTempFX );
 
-                                aColRes.SetRed( MAP( cR0, cR1, nTempFY ) );
-                                aColRes.SetGreen( MAP( cG0, cG1, nTempFY ) );
-                                aColRes.SetBlue( MAP( cB0, cB1, nTempFY ) );
+                                BitmapColor aColRes( MAP( cR0, cR1, nTempFY ),
+                                        MAP( cG0, cG1, nTempFY ),
+                                        MAP( cB0, cB1, nTempFY ) );
                                 pWAcc->SetPixel( nYDst, nXDst++, aColRes );
                             }
                         }
@@ -1480,9 +1478,9 @@ sal_Bool Bitmap::ImplScaleSuper(
                                     nTotalWeightY += nWeightY;
                                 }
 
-                                aColRes.SetRed( ( sal_uInt8 ) (( nSumR / nTotalWeightY ) ));
-                                aColRes.SetGreen( ( sal_uInt8 ) (( nSumG / nTotalWeightY) ));
-                                aColRes.SetBlue( ( sal_uInt8 ) (( nSumB / nTotalWeightY ) ));
+                                BitmapColor aColRes ( ( sal_uInt8 ) (( nSumR / nTotalWeightY ) ),
+                                        ( sal_uInt8 ) (( nSumG / nTotalWeightY) ),
+                                        ( sal_uInt8 ) (( nSumB / nTotalWeightY) ) );
                                 pWAcc->SetPixel( nYDst, nXDst++, aColRes );
 
                             }
@@ -1503,21 +1501,21 @@ sal_Bool Bitmap::ImplScaleSuper(
                                 long nTempX = pMapIX[ nX ];
                                 long nTempFX = pMapFX[ nX ];
 
-                                aCol0 = pAcc->GetPaletteColor( pAcc->GetPixelIndex( nTempY, nTempX ) );
-                                aCol1 = pAcc->GetPaletteColor( pAcc->GetPixelIndex( nTempY, ++nTempX ) );
-                                cR0 = MAP( aCol0.GetRed(), aCol1.GetRed(), nTempFX );
-                                cG0 = MAP( aCol0.GetGreen(), aCol1.GetGreen(), nTempFX );
-                                cB0 = MAP( aCol0.GetBlue(), aCol1.GetBlue(), nTempFX );
+                                BitmapColor aCol0 = pAcc->GetPaletteColor( pAcc->GetPixelIndex( nTempY, nTempX ) );
+                                BitmapColor aCol1 = pAcc->GetPaletteColor( pAcc->GetPixelIndex( nTempY, ++nTempX ) );
+                                sal_uInt8 cR0 = MAP( aCol0.GetRed(), aCol1.GetRed(), nTempFX );
+                                sal_uInt8 cG0 = MAP( aCol0.GetGreen(), aCol1.GetGreen(), nTempFX );
+                                sal_uInt8 cB0 = MAP( aCol0.GetBlue(), aCol1.GetBlue(), nTempFX );
 
                                 aCol1 = pAcc->GetPaletteColor( pAcc->GetPixelIndex( ++nTempY, nTempX ) );
                                 aCol0 = pAcc->GetPaletteColor( pAcc->GetPixelIndex( nTempY--, --nTempX ) );
-                                cR1 = MAP( aCol0.GetRed(), aCol1.GetRed(), nTempFX );
-                                cG1 = MAP( aCol0.GetGreen(), aCol1.GetGreen(), nTempFX );
-                                cB1 = MAP( aCol0.GetBlue(), aCol1.GetBlue(), nTempFX );
+                                sal_uInt8 cR1 = MAP( aCol0.GetRed(), aCol1.GetRed(), nTempFX );
+                                sal_uInt8 cG1 = MAP( aCol0.GetGreen(), aCol1.GetGreen(), nTempFX );
+                                sal_uInt8 cB1 = MAP( aCol0.GetBlue(), aCol1.GetBlue(), nTempFX );
 
-                                aColRes.SetRed( MAP( cR0, cR1, nTempFY ) );
-                                aColRes.SetGreen( MAP( cG0, cG1, nTempFY ) );
-                                aColRes.SetBlue( MAP( cB0, cB1, nTempFY ) );
+                                BitmapColor aColRes( MAP( cR0, cR1, nTempFY ),
+                                        MAP( cG0, cG1, nTempFY ),
+                                        MAP( cB0, cB1, nTempFY ) );
                                 pWAcc->SetPixel( nYDst, nXDst++, aColRes );
                             }
                         }
@@ -1571,7 +1569,7 @@ sal_Bool Bitmap::ImplScaleSuper(
 
                                     for(int j = 0; j <= nRowRange; j++)
                                     {
-                                        aCol0 = pAcc->GetPaletteColor ( pAcc->GetPixelIndex( nLineStart + i, nRowStart + j ) );
+                                        BitmapColor aCol0 = pAcc->GetPaletteColor ( pAcc->GetPixelIndex( nLineStart + i, nRowStart + j ) );
 
                                         if(nX == nEndX )
                                         {
@@ -1626,9 +1624,9 @@ sal_Bool Bitmap::ImplScaleSuper(
                                     nTotalWeightY += nWeightY;
                                 }
 
-                                aColRes.SetRed( ( sal_uInt8 ) (( nSumR / nTotalWeightY ) ));
-                                aColRes.SetGreen( ( sal_uInt8 ) (( nSumG / nTotalWeightY) ));
-                                aColRes.SetBlue( ( sal_uInt8 ) (( nSumB / nTotalWeightY ) ));
+                                BitmapColor aColRes( ( sal_uInt8 ) (( nSumR / nTotalWeightY ) ),
+                                        ( sal_uInt8 ) (( nSumG / nTotalWeightY) ),
+                                        ( sal_uInt8 ) (( nSumB / nTotalWeightY) ));
                                 pWAcc->SetPixel( nYDst, nXDst++, aColRes );
                             }
                         }
@@ -1657,18 +1655,18 @@ sal_Bool Bitmap::ImplScaleSuper(
                                 long nTempFX = pMapFX[ nX ];
 
                                 pTmp1 = ( pTmp0 = pLine0 + nOff ) + 3L;
-                                cB0 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
-                                cG0 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
-                                cR0 = MAP( *pTmp0, *pTmp1, nTempFX );
+                                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 );
 
                                 pTmp1 = ( pTmp0 = pLine1 + nOff ) + 3L;
-                                cB1 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
-                                cG1 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
-                                cR1 = MAP( *pTmp0, *pTmp1, nTempFX );
+                                sal_uInt8 cB1 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
+                                sal_uInt8 cG1 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
+                                sal_uInt8 cR1 = MAP( *pTmp0, *pTmp1, nTempFX );
 
-                                aColRes.SetRed( MAP( cR0, cR1, nTempFY ) );
-                                aColRes.SetGreen( MAP( cG0, cG1, nTempFY ) );
-                                aColRes.SetBlue( MAP( cB0, cB1, nTempFY ) );
+                                BitmapColor aColRes( MAP( cR0, cR1, nTempFY ),
+                                        MAP( cG0, cG1, nTempFY ),
+                                        MAP( cB0, cB1, nTempFY ) );
                                 pWAcc->SetPixel( nYDst, nXDst++, aColRes );
                             }
                         }
@@ -1773,9 +1771,9 @@ sal_Bool Bitmap::ImplScaleSuper(
                                     nTotalWeightY += nWeightY;
                                 }
 
-                                aColRes.SetRed( ( sal_uInt8 ) (( nSumR / nTotalWeightY ) ));
-                                aColRes.SetGreen( ( sal_uInt8 ) (( nSumG / nTotalWeightY) ));
-                                aColRes.SetBlue( ( sal_uInt8 ) (( nSumB / nTotalWeightY ) ));
+                                BitmapColor aColRes( ( sal_uInt8 ) (( nSumR / nTotalWeightY ) ),
+                                        ( sal_uInt8 ) (( nSumG / nTotalWeightY) ),
+                                        ( sal_uInt8 ) (( nSumB / nTotalWeightY) ));
                                 pWAcc->SetPixel( nYDst, nXDst++, aColRes );
 
                             }
@@ -1802,18 +1800,18 @@ sal_Bool Bitmap::ImplScaleSuper(
                                 long nTempFX = pMapFX[ nX ];
 
                                 pTmp1 = ( pTmp0 = pLine0 + nOff ) + 3L;
-                                cR0 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
-                                cG0 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
-                                cB0 = MAP( *pTmp0, *pTmp1, nTempFX );
+                                sal_uInt8 cR0 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
+                                sal_uInt8 cG0 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
+                                sal_uInt8 cB0 = MAP( *pTmp0, *pTmp1, nTempFX );
 
                                 pTmp1 = ( pTmp0 = pLine1 + nOff ) + 3L;
-                                cR1 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
-                                cG1 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
-                                cB1 = MAP( *pTmp0, *pTmp1, nTempFX );
+                                sal_uInt8 cR1 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
+                                sal_uInt8 cG1 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
+                                sal_uInt8 cB1 = MAP( *pTmp0, *pTmp1, nTempFX );
 
-                                aColRes.SetRed( MAP( cR0, cR1, nTempFY ) );
-                                aColRes.SetGreen( MAP( cG0, cG1, nTempFY ) );
-                                aColRes.SetBlue( MAP( cB0, cB1, nTempFY ) );
+                                BitmapColor aColRes( MAP( cR0, cR1, nTempFY ),
+                                        MAP( cG0, cG1, nTempFY ),
+                                        MAP( cB0, cB1, nTempFY ) );
                                 pWAcc->SetPixel( nYDst, nXDst++, aColRes );
                             }
                         }
@@ -1918,11 +1916,10 @@ sal_Bool Bitmap::ImplScaleSuper(
                                     nTotalWeightY += nWeightY;
                                 }
 
-                                aColRes.SetRed( ( sal_uInt8 ) (( nSumR / nTotalWeightY ) ));
-                                aColRes.SetGreen( ( sal_uInt8 ) (( nSumG / nTotalWeightY) ));
-                                aColRes.SetBlue( ( sal_uInt8 ) (( nSumB / nTotalWeightY ) ));
+                                BitmapColor aColRes( ( sal_uInt8 ) (( nSumR / nTotalWeightY ) ),
+                                        ( sal_uInt8 ) (( nSumG / nTotalWeightY) ),
+                                        ( sal_uInt8 ) (( nSumB / nTotalWeightY) ));
                                 pWAcc->SetPixel( nYDst, nXDst++, aColRes );
-
                             }
                         }
                     }
@@ -1941,21 +1938,21 @@ sal_Bool Bitmap::ImplScaleSuper(
                                 long nTempX = pMapIX[ nX ];
                                 long nTempFX = pMapFX[ nX ];
 
-                                aCol0 = pAcc->GetPixel( nTempY, nTempX );
-                                aCol1 = pAcc->GetPixel( nTempY, ++nTempX );
-                                cR0 = MAP( aCol0.GetRed(), aCol1.GetRed(), nTempFX );
-                                cG0 = MAP( aCol0.GetGreen(), aCol1.GetGreen(), nTempFX );
-                                cB0 = MAP( aCol0.GetBlue(), aCol1.GetBlue(), nTempFX );
+                                BitmapColor aCol0 = pAcc->GetPixel( nTempY, nTempX );
+                                BitmapColor aCol1 = pAcc->GetPixel( nTempY, ++nTempX );
+                                sal_uInt8 cR0 = MAP( aCol0.GetRed(), aCol1.GetRed(), nTempFX );
+                                sal_uInt8 cG0 = MAP( aCol0.GetGreen(), aCol1.GetGreen(), nTempFX );
+                                sal_uInt8 cB0 = MAP( aCol0.GetBlue(), aCol1.GetBlue(), nTempFX );
 
                                 aCol1 = pAcc->GetPixel( ++nTempY, nTempX );
                                 aCol0 = pAcc->GetPixel( nTempY--, --nTempX );
-                                cR1 = MAP( aCol0.GetRed(), aCol1.GetRed(), nTempFX );
-                                cG1 = MAP( aCol0.GetGreen(), aCol1.GetGreen(), nTempFX );
-                                cB1 = MAP( aCol0.GetBlue(), aCol1.GetBlue(), nTempFX );
+                                sal_uInt8 cR1 = MAP( aCol0.GetRed(), aCol1.GetRed(), nTempFX );
+                                sal_uInt8 cG1 = MAP( aCol0.GetGreen(), aCol1.GetGreen(), nTempFX );
+                                sal_uInt8 cB1 = MAP( aCol0.GetBlue(), aCol1.GetBlue(), nTempFX );
 
-                                aColRes.SetRed( MAP( cR0, cR1, nTempFY ) );
-                                aColRes.SetGreen( MAP( cG0, cG1, nTempFY ) );
-                                aColRes.SetBlue( MAP( cB0, cB1, nTempFY ) );
+                                BitmapColor aColRes( MAP( cR0, cR1, nTempFY ),
+                                        MAP( cG0, cG1, nTempFY ),
+                                        MAP( cB0, cB1, nTempFY ) );
                                 pWAcc->SetPixel( nYDst, nXDst++, aColRes );
                             }
                         }
@@ -2008,7 +2005,7 @@ sal_Bool Bitmap::ImplScaleSuper(
 
                                     for(int j = 0; j <= nRowRange; j++)
                                     {
-                                        aCol0 = pAcc->GetPixel( nLineStart + i, nRowStart + j );
+                                        BitmapColor aCol0 = pAcc->GetPixel( nLineStart + i, nRowStart + j );
 
                                         if(nX == nEndX )
                                         {
@@ -2062,9 +2059,9 @@ sal_Bool Bitmap::ImplScaleSuper(
                                     nTotalWeightY += nWeightY;
                                 }
 
-                                aColRes.SetRed( ( sal_uInt8 ) (( nSumR / nTotalWeightY ) ));
-                                aColRes.SetGreen( ( sal_uInt8 ) (( nSumG / nTotalWeightY) ));
-                                aColRes.SetBlue( ( sal_uInt8 ) (( nSumB / nTotalWeightY ) ));
+                                BitmapColor aColRes( ( sal_uInt8 ) (( nSumR / nTotalWeightY) ),
+                                        ( sal_uInt8 ) (( nSumG / nTotalWeightY) ),
+                                        ( sal_uInt8 ) (( nSumB / nTotalWeightY) ));
                                 pWAcc->SetPixel( nYDst, nXDst++, aColRes );
 
                             }
commit 2da8bfe2da964cd43e1c709890fddd3c05dcecd1
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Feb 20 03:07:28 2014 +0100

    make these variables const, they are just loop boundaries
    
    Change-Id: I66c67c424c43515043e4119ea6bfad0d7f31ccb1

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 845b401..eae1227 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -1306,10 +1306,10 @@ sal_Bool Bitmap::ImplScaleSuper(
         boost::scoped_array<long> pMapFX(new long[ nDstW ]);
         boost::scoped_array<long> pMapFY(new long[ nDstH ]);
         sal_uInt8 cR0, cG0, cB0, cR1, cG1, cB1;
-        long nStartX = 0 , nStartY = 0;
-        long nEndX = nDstW - 1L;
-        long nEndY = nDstH - 1L;
-        long nMax = 1 << 7L;
+        const long nStartX = 0, nStartY = 0;
+        const long nEndX = nDstW - 1L;
+        const long nEndY = nDstH - 1L;
+        const long nMax = 1 << 7L;
 
         if( pAcc && pWAcc )
         {
commit 59253eb3193b9d175a906a6cbe9b870509ef8644
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Feb 20 03:04:10 2014 +0100

    reduce scope for more variables
    
    many more to go
    
    Change-Id: Ia941638ef31138af132b142f0e960f7959b18dda

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 1c01f09..845b401 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -1305,14 +1305,11 @@ sal_Bool Bitmap::ImplScaleSuper(
         boost::scoped_array<long> pMapIY(new long[ nDstH ]);
         boost::scoped_array<long> pMapFX(new long[ nDstW ]);
         boost::scoped_array<long> pMapFY(new long[ nDstH ]);
-        long                nX, nY, nXDst, nYDst;;
-        double              fTemp;
-        long                nTemp , nTempX, nTempY, nTempFX, nTempFY;
-        sal_uInt8           cR0, cG0, cB0, cR1, cG1, cB1;
-        long                nStartX = 0 , nStartY = 0;
-        long                nEndX = nDstW - 1L;
-        long                nEndY = nDstH - 1L;
-        long                nMax = 1 << 7L;
+        sal_uInt8 cR0, cG0, cB0, cR1, cG1, cB1;
+        long nStartX = 0 , nStartY = 0;
+        long nEndX = nDstW - 1L;
+        long nEndY = nDstH - 1L;
+        long nMax = 1 << 7L;
 
         if( pAcc && pWAcc )
         {
@@ -1322,9 +1319,9 @@ sal_Bool Bitmap::ImplScaleSuper(
             const double    fRevScaleY = ( nDstH > 1L ) ? ( (double) ( nH - 1 ) / ( nDstH - 1 ) ) : 0.0;
 
             // create horizontal mapping table
-            for( nX = 0L, nTempX = nW - 1L, nTemp = nW - 2L; nX < nDstW; nX++ )
+            for( long nX = 0L, nTempX = nW - 1L, nTemp = nW - 2L; nX < nDstW; nX++ )
             {
-                fTemp = nX * fRevScaleX;
+                double fTemp = nX * fRevScaleX;
 
                 if( bHMirr )
                     fTemp = nTempX - fTemp;
@@ -1333,9 +1330,9 @@ sal_Bool Bitmap::ImplScaleSuper(
             }
 
             // create vertical mapping table
-            for( nY = 0L, nTempY = nH - 1L, nTemp = nH - 2L; nY < nDstH; nY++ )
+            for( long nY = 0L, nTempY = nH - 1L, nTemp = nH - 2L; nY < nDstH; nY++ )
             {
-                fTemp = nY * fRevScaleY;
+                double fTemp = nY * fRevScaleY;
 
                 if( bVMirr )
                     fTemp = nTempY - fTemp;
@@ -1349,15 +1346,17 @@ sal_Bool Bitmap::ImplScaleSuper(
                 {
                     if( scaleX >= fScaleThresh && scaleY >= fScaleThresh )
                     {
-                        for( nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
+                        for( long nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
                         {
-                            nTempY = pMapIY[ nY ]; nTempFY = pMapFY[ nY ];
+                            long nTempY = pMapIY[ nY ];
+                            long nTempFY = pMapFY[ nY ];
                             Scanline pLine0 = pAcc->GetScanline( nTempY );
                             Scanline pLine1 = pAcc->GetScanline( ++nTempY );
 
-                            for( nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ )
+                            for(long nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ )
                             {
-                                nTempX = pMapIX[ nX ]; nTempFX = pMapFX[ nX ];
+                                long nTempX = pMapIX[ nX ];
+                                long nTempFX = pMapFX[ nX ];
 
                                 const BitmapColor& rCol0 = pAcc->GetPaletteColor( pLine0[ nTempX ] );
                                 const BitmapColor& rCol2 = pAcc->GetPaletteColor( pLine1[ nTempX ] );
@@ -1381,7 +1380,7 @@ sal_Bool Bitmap::ImplScaleSuper(
                     }
                     else
                     {
-                        for( nY = nStartY , nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
+                        for( long nY = nStartY , nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
                         {
                             long nTop = bVMirr ? ( nY + 1 ) : nY;
                             long nBottom = bVMirr ? nY : ( nY + 1 ) ;
@@ -1398,7 +1397,7 @@ sal_Bool Bitmap::ImplScaleSuper(
                                 nLineRange = ( pMapIY[ nBottom ] == pMapIY[ nTop ] ) ? 1 :( pMapIY[ nBottom ] - pMapIY[ nTop ] );
                             }
 
-                            for( nX = nStartX , nXDst = 0L; nX <= nEndX; nX++ )
+                            for( long nX = nStartX , nXDst = 0L; nX <= nEndX; nX++ )
                             {
                                 long nLeft = bHMirr ? ( nX + 1 ) : nX;
                                 long nRight = bHMirr ? nX : ( nX + 1 ) ;
@@ -1494,13 +1493,15 @@ sal_Bool Bitmap::ImplScaleSuper(
                 {
                     if( scaleX >= fScaleThresh && scaleY >= fScaleThresh )
                     {
-                        for( nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
+                        for( long nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
                         {
-                            nTempY = pMapIY[ nY ], nTempFY = pMapFY[ nY ];
+                            long nTempY = pMapIY[ nY ];
+                            long nTempFY = pMapFY[ nY ];
 
-                            for( nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ )
+                            for( long nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ )
                             {
-                                nTempX = pMapIX[ nX ]; nTempFX = pMapFX[ nX ];
+                                long nTempX = pMapIX[ nX ];
+                                long nTempFX = pMapFX[ nX ];
 
                                 aCol0 = pAcc->GetPaletteColor( pAcc->GetPixelIndex( nTempY, nTempX ) );
                                 aCol1 = pAcc->GetPaletteColor( pAcc->GetPixelIndex( nTempY, ++nTempX ) );
@@ -1524,14 +1525,14 @@ sal_Bool Bitmap::ImplScaleSuper(
                     }
                     else
                     {
-                        long        nSumR, nSumG, nSumB,nLineStart , nLineRange, nRowStart , nRowRange ;
-                        long        nLeft, nRight, nTop, nBottom, nWeightX, nWeightY ;
-                        long        nSumRowR ,nSumRowG,nSumRowB, nTotalWeightX, nTotalWeightY;
+                        long nSumR, nSumG, nSumB,nLineStart , nLineRange, nRowStart , nRowRange ;
+                        long nLeft, nRight, nWeightX, nWeightY ;
+                        long nSumRowR ,nSumRowG,nSumRowB, nTotalWeightX, nTotalWeightY;
 
-                        for( nY = nStartY , nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
+                        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 ) ;
 
                             if( nY ==nEndY )
                             {
@@ -1544,7 +1545,7 @@ sal_Bool Bitmap::ImplScaleSuper(
                                 nLineRange = ( pMapIY[ nBottom ] == pMapIY[ nTop ] ) ? 1 :( pMapIY[ nBottom ] - pMapIY[ nTop ] );
                             }
 
-                            for( nX = nStartX , nXDst = 0L; nX <= nEndX; nX++ )
+                            for( long nX = nStartX , nXDst = 0L; nX <= nEndX; nX++ )
                             {
                                 nLeft = bHMirr ? ( nX + 1 ) : nX;
                                 nRight = bHMirr ? nX : ( nX + 1 ) ;
@@ -1643,16 +1644,17 @@ sal_Bool Bitmap::ImplScaleSuper(
                         Scanline    pLine0, pLine1, pTmp0, pTmp1;
                         long        nOff;
 
-                        for( nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
+                        for( long nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
                         {
-                            nTempY = pMapIY[ nY ]; nTempFY = pMapFY[ nY ];
+                            long nTempY = pMapIY[ nY ];
+                            long nTempFY = pMapFY[ nY ];
                             pLine0 = pAcc->GetScanline( nTempY );
                             pLine1 = pAcc->GetScanline( ++nTempY );
 
-                            for( nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ )
+                            for( long nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ )
                             {
-                                nOff = 3L * ( nTempX = pMapIX[ nX ] );
-                                nTempFX = pMapFX[ nX ];
+                                nOff = 3L * pMapIX[ nX ];
+                                long nTempFX = pMapFX[ nX ];
 
                                 pTmp1 = ( pTmp0 = pLine0 + nOff ) + 3L;
                                 cB0 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
@@ -1678,7 +1680,7 @@ sal_Bool Bitmap::ImplScaleSuper(
                         long        nLeft, nRight, nTop, nBottom, nWeightX, nWeightY ;
                         long        nSumRowR ,nSumRowG,nSumRowB, nTotalWeightX, nTotalWeightY;
 
-                        for( nY = nStartY , nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
+                        for( long nY = nStartY , nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
                         {
                             nTop = bVMirr ? ( nY + 1 ) : nY;
                             nBottom = bVMirr ? nY : ( nY + 1 ) ;
@@ -1694,7 +1696,7 @@ sal_Bool Bitmap::ImplScaleSuper(
                                 nLineRange = ( pMapIY[ nBottom ] == pMapIY[ nTop ] ) ? 1 :( pMapIY[ nBottom ] - pMapIY[ nTop ] );
                             }
 
-                            for( nX = nStartX , nXDst = 0L; nX <= nEndX; nX++ )
+                            for( long nX = nStartX , nXDst = 0L; nX <= nEndX; nX++ )
                             {
                                 nLeft = bHMirr ? ( nX + 1 ) : nX;
                                 nRight = bHMirr ? nX : ( nX + 1 ) ;
@@ -1787,16 +1789,17 @@ sal_Bool Bitmap::ImplScaleSuper(
                         Scanline    pLine0, pLine1, pTmp0, pTmp1;
                         long        nOff;
 
-                        for( nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
+                        for( long nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
                         {
-                            nTempY = pMapIY[ nY ]; nTempFY = pMapFY[ nY ];
+                            long nTempY = pMapIY[ nY ];
+                            long nTempFY = pMapFY[ nY ];
                             pLine0 = pAcc->GetScanline( nTempY );
                             pLine1 = pAcc->GetScanline( ++nTempY );
 
-                            for( nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ )
+                            for( long nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ )
                             {
-                                nOff = 3L * ( nTempX = pMapIX[ nX ] );
-                                nTempFX = pMapFX[ nX ];
+                                nOff = 3L * pMapIX[ nX ];
+                                long nTempFX = pMapFX[ nX ];
 
                                 pTmp1 = ( pTmp0 = pLine0 + nOff ) + 3L;
                                 cR0 = MAP( *pTmp0, *pTmp1, nTempFX ); pTmp0++; pTmp1++;
@@ -1822,7 +1825,7 @@ sal_Bool Bitmap::ImplScaleSuper(
                         long        nLeft, nRight, nTop, nBottom, nWeightX, nWeightY ;
                         long        nSumRowR ,nSumRowG,nSumRowB, nTotalWeightX, nTotalWeightY;
 
-                        for( nY = nStartY , nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
+                        for( long nY = nStartY , nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
                         {
                             nTop = bVMirr ? ( nY + 1 ) : nY;
                             nBottom = bVMirr ? nY : ( nY + 1 ) ;
@@ -1838,7 +1841,7 @@ sal_Bool Bitmap::ImplScaleSuper(
                                 nLineRange = ( pMapIY[ nBottom ] == pMapIY[ nTop ] ) ? 1 :( pMapIY[ nBottom ] - pMapIY[ nTop ] );
                             }
 
-                            for( nX = nStartX , nXDst = 0L; nX <= nEndX; nX++ )
+                            for( long nX = nStartX , nXDst = 0L; nX <= nEndX; nX++ )
                             {
                                 nLeft = bHMirr ? ( nX + 1 ) : nX;
                                 nRight = bHMirr ? nX : ( nX + 1 ) ;
@@ -1928,13 +1931,15 @@ sal_Bool Bitmap::ImplScaleSuper(
                 {
                     if( scaleX >= fScaleThresh && scaleY >= fScaleThresh )
                     {
-                        for( nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
+                        for( long nY = nStartY, nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
                         {
-                            nTempY = pMapIY[ nY ]; nTempFY = pMapFY[ nY ];
+                            long nTempY = pMapIY[ nY ];
+                            long nTempFY = pMapFY[ nY ];
 
-                            for( nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ )
+                            for( long nX = nStartX, nXDst = 0L; nX <= nEndX; nX++ )
                             {
-                                nTempX = pMapIX[ nX ]; nTempFX = pMapFX[ nX ];
+                                long nTempX = pMapIX[ nX ];
+                                long nTempFX = pMapFX[ nX ];
 
                                 aCol0 = pAcc->GetPixel( nTempY, nTempX );
                                 aCol1 = pAcc->GetPixel( nTempY, ++nTempX );
@@ -1961,7 +1966,7 @@ sal_Bool Bitmap::ImplScaleSuper(
                         long        nLeft, nRight, nTop, nBottom, nWeightX, nWeightY ;
                         long        nSumRowR ,nSumRowG,nSumRowB, nTotalWeightX, nTotalWeightY;
 
-                        for( nY = nStartY , nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
+                        for( long nY = nStartY , nYDst = 0L; nY <= nEndY; nY++, nYDst++ )
                         {
                             nTop = bVMirr ? ( nY + 1 ) : nY;
                             nBottom = bVMirr ? nY : ( nY + 1 ) ;
@@ -1977,7 +1982,7 @@ sal_Bool Bitmap::ImplScaleSuper(
                                 nLineRange = ( pMapIY[ nBottom ] == pMapIY[ nTop ] ) ? 1 :( pMapIY[ nBottom ] - pMapIY[ nTop ] );
                             }
 
-                            for( nX = nStartX , nXDst = 0L; nX <= nEndX; nX++ )
+                            for( long nX = nStartX , nXDst = 0L; nX <= nEndX; nX++ )
                             {
                                 nLeft = bHMirr ? ( nX + 1 ) : nX;
                                 nRight = bHMirr ? nX : ( nX + 1 ) ;
commit cf0028eaf6c8f09a4f5753005d65505ea9135246
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Thu Feb 20 02:30:39 2014 +0100

    reduce scope of many variables
    
    Change-Id: Id401a0414f650fb2ee14d895d261f9e38cd104b0

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index 16e8848..1c01f09 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 );
commit 38f9952a7d7f622b22dad653a174c885ad91f1a7
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Wed Feb 19 23:45:44 2014 +0100

    make the assignment a bit more obvious
    
    We prefer readable code.
    
    Change-Id: I8212c0a40354b2fd1d6e56c1223c3b558104f505

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index dbf2174..16e8848 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -1328,8 +1328,8 @@ sal_Bool Bitmap::ImplScaleSuper(
 
                 if( bHMirr )
                     fTemp = nTempX - fTemp;
-
-                pMapFX[ nX ] = (long) ( ( fTemp - ( pMapIX[ nX ] = MinMax( (long) fTemp, 0, nTemp ) ) ) * 128. );
+                pMapIX[ nX ] = MinMax( (long) fTemp, 0, nTemp );
+                pMapFX[ nX ] = (long) ( ( fTemp - pMapIX ) * 128. );
             }
 
             // create vertical mapping table
@@ -1339,8 +1339,8 @@ sal_Bool Bitmap::ImplScaleSuper(
 
                 if( bVMirr )
                     fTemp = nTempY - fTemp;
-
-                pMapFY[ nY ] = (long) ( ( fTemp - ( pMapIY[ nY ] = MinMax( (long) fTemp, 0, nTemp ) ) ) * 128. );
+                pMapIY[ nY ] = MinMax( (long) fTemp, 0, nTemp );
+                pMapFY[ nY ] = (long) ( ( fTemp - pMapIY[nY] ) * 128. );
             }
 
             if( pAcc->HasPalette() )
commit abfe6e9866774aced6fac97e65415fa90107ad9b
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Wed Feb 19 23:42:46 2014 +0100

    remove explicit memory management
    
    Change-Id: Id9b02dcb65d21bcdef398188d739a56b11f63d21

diff --git a/vcl/source/gdi/bitmap3.cxx b/vcl/source/gdi/bitmap3.cxx
index a4accba..dbf2174 100644
--- a/vcl/source/gdi/bitmap3.cxx
+++ b/vcl/source/gdi/bitmap3.cxx
@@ -24,6 +24,8 @@
 #include <vcl/bitmapex.hxx>
 #include <vcl/bitmap.hxx>
 
+#include <boost/scoped_array.hpp>
+
 #include <impoct.hxx>
 #include <impvect.hxx>
 
@@ -1299,10 +1301,10 @@ sal_Bool Bitmap::ImplScaleSuper(
         BitmapReadAccess*   pAcc = AcquireReadAccess();
         Bitmap              aOutBmp( Size( nDstW, nDstH ), 24 );
         BitmapWriteAccess*  pWAcc = aOutBmp.AcquireWriteAccess();
-        long*               pMapIX = new long[ nDstW ];
-        long*               pMapIY = new long[ nDstH ];
-        long*               pMapFX = new long[ nDstW ];
-        long*               pMapFY = new long[ nDstH ];
+        boost::scoped_array<long> pMapIX(new long[ nDstW ]);
+        boost::scoped_array<long> pMapIY(new long[ nDstH ]);
+        boost::scoped_array<long> pMapFX(new long[ nDstW ]);
+        boost::scoped_array<long> pMapFY(new long[ nDstH ]);
         long                nX, nY, nXDst, nYDst;;
         double              fTemp;
         long                nTemp , nTempX, nTempY, nTempFX, nTempFY;
@@ -2070,11 +2072,6 @@ sal_Bool Bitmap::ImplScaleSuper(
             bRet = true;
         }
 
-        delete[] pMapIX;
-        delete[] pMapIY;
-        delete[] pMapFX;
-        delete[] pMapFY;
-
         if(pAcc)
         {
             ReleaseAccess( pAcc );


More information about the Libreoffice-commits mailing list