vcl/source/filter/ixpm/xpmread.cxx |   49 +++++++++++++++++++------------------
 1 file changed, 26 insertions(+), 23 deletions(-)

New commits:
commit d05f56b160390022fdb0c21eed5e430440cd79ca
Author: Caolán McNamara <caol...@redhat.com>
Date:   Fri Jan 13 11:33:19 2017 +0000

    make this a tiny bit less unreadable
    
    Change-Id: Ib8205e76f6d1d59ef06eba6e3365c0b4cad0ecaf

diff --git a/vcl/source/filter/ixpm/xpmread.cxx 
b/vcl/source/filter/ixpm/xpmread.cxx
index 6402802..968e6a3 100644
--- a/vcl/source/filter/ixpm/xpmread.cxx
+++ b/vcl/source/filter/ixpm/xpmread.cxx
@@ -316,44 +316,47 @@ bool XPMReader::ImplGetScanLine( sal_uLong nY )
             bStatus = false;
         else
         {
-            sal_uLong i, j;
-            if ( mpFastColorTable )
+            if (mpFastColorTable)
             {
-                for ( i = 0; i < mnWidth; i++ )
+                for (sal_uLong i = 0; i < mnWidth; ++i)
                 {
-                    j = (*pString++) << 8;
+                    sal_uLong j = (*pString++) << 8;
                     j += *pString++;
-                    sal_uInt8 k = (sal_uInt8)mpFastColorTable[ j ];
-                    mpAcc->SetPixel( nY, i, BitmapColor( (sal_uInt8)k ) );
+                    const sal_uInt8 k = mpFastColorTable[j];
+                    mpAcc->SetPixel(nY, i, BitmapColor(k));
 
                     if ( mpMaskAcc )
-                        mpMaskAcc->SetPixel( nY, i,
-                            ( mpColMap[ k * (mnCpp + 4) + mnCpp] ) ? aWhite : 
aBlack );
+                    {
+                        const sal_uLong nMapIndex = k * (mnCpp + 4) + mnCpp;
+                        mpMaskAcc->SetPixel(nY, i, mpColMap[nMapIndex] ? 
aWhite : aBlack);
+                    }
                 }
             }
-            else for ( i = 0; i < mnWidth; i++ )
+            else
             {
-                pColor = mpColMap;
-                for ( j = 0; j < mnColors; j++ )
+                for (sal_uLong i = 0; i < mnWidth; ++i)
                 {
-                    if ( ImplCompare( pString, pColor, mnCpp, XPMCASESENSITIVE 
) )
+                    pColor = mpColMap;
+                    for (sal_uLong j = 0; j < mnColors; ++j)
                     {
-                        if ( mnColors > 256 )
-                            mpAcc->SetPixel( nY, i, Color ( pColor[3], 
pColor[4], pColor[5] ) );
-                        else
-                            mpAcc->SetPixel( nY, i, BitmapColor( (sal_uInt8) j 
) );
+                        if ( ImplCompare( pString, pColor, mnCpp, 
XPMCASESENSITIVE ) )
+                        {
+                            if ( mnColors > 256 )
+                                mpAcc->SetPixel( nY, i, Color ( pColor[3], 
pColor[4], pColor[5] ) );
+                            else
+                                mpAcc->SetPixel( nY, i, BitmapColor( 
(sal_uInt8) j ) );
 
-                        if ( mpMaskAcc )
-                            mpMaskAcc->SetPixel( nY, i, (
-                                pColor[ mnCpp ] ) ? aWhite : aBlack );
+                            if ( mpMaskAcc )
+                                mpMaskAcc->SetPixel( nY, i, (
+                                    pColor[ mnCpp ] ) ? aWhite : aBlack );
 
-                        break;
+                            break;
+                        }
+                        pColor += ( mnCpp + 4 );
                     }
-                    pColor += ( mnCpp + 4 );
+                    pString += mnCpp;
                 }
-                pString += mnCpp;
             }
-
         }
     }
     return bStatus;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to