summaryrefslogtreecommitdiff
path: root/include/vcl/salbtype.hxx
diff options
context:
space:
mode:
authorMatteo Casalin <matteo.casalin@yahoo.com>2015-08-18 08:15:38 +0200
committerMatteo Casalin <matteo.casalin@yahoo.com>2015-08-21 22:29:41 +0200
commite28c9ccb014df9616d7a3f3fa1f1b5866d836d94 (patch)
treeaa4cf9a34eed02e24ed86ad2d7589bef2c6e34ab /include/vcl/salbtype.hxx
parent2c3fcc57ea38ad3e4fdd6808343e82321ec0028a (diff)
There's no need to loop backward, in the end
Change-Id: I2ef533fcc2ac29446a07b98ab34acf1887909c6b
Diffstat (limited to 'include/vcl/salbtype.hxx')
-rw-r--r--include/vcl/salbtype.hxx20
1 files changed, 6 insertions, 14 deletions
diff --git a/include/vcl/salbtype.hxx b/include/vcl/salbtype.hxx
index fc9445080961..15130a636971 100644
--- a/include/vcl/salbtype.hxx
+++ b/include/vcl/salbtype.hxx
@@ -550,22 +550,14 @@ inline sal_uInt16 BitmapPalette::GetBestIndex( const BitmapColor& rCol ) const
return j;
}
- nRetIndex = mnCount - 1;
- if( nRetIndex )
+ sal_uLong nLastErr = rCol.GetColorError( mpBitmapColor[ nRetIndex ] );
+ for( sal_uInt16 i = 1; i < mnCount; ++i )
{
- sal_uLong nLastErr = rCol.GetColorError( mpBitmapColor[ nRetIndex ] );
- sal_uInt16 i = nRetIndex - 1;
- for(;;)
+ const sal_uLong nActErr = rCol.GetColorError( mpBitmapColor[ i ] );
+ if ( nActErr < nLastErr )
{
- const sal_uLong nActErr = rCol.GetColorError( mpBitmapColor[ i ] );
- if ( nActErr < nLastErr )
- {
- nLastErr = nActErr;
- nRetIndex = i;
- }
- if (!i)
- break;
- --i;
+ nLastErr = nActErr;
+ nRetIndex = i;
}
}
}