summaryrefslogtreecommitdiff
path: root/vcl/source/gdi/impbmp.cxx
diff options
context:
space:
mode:
authorDaniel Robertson <danlrobertson89@gmail.com>2015-11-03 12:22:29 -0500
committerjan iversen <jani@documentfoundation.org>2016-01-08 12:53:59 +0000
commit7ec5073951cf7b7f71369e0819f82ae2fc6971ac (patch)
treef39f6dceb0a0f99ad4fcbf34f674a9a6c4b7e6e7 /vcl/source/gdi/impbmp.cxx
parent3113ecb2fcb6d868a213c5dc978159e18f4e2efa (diff)
vcl: ImpBitmap optimize GetBitCount
Use binary search to find ImpBitmap BitCount in constant time. Change-Id: Ica13d41d1473e01c9198c985d34206267d7910d1 Reviewed-on: https://gerrit.libreoffice.org/19759 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: jan iversen <jani@documentfoundation.org> Tested-by: jan iversen <jani@documentfoundation.org>
Diffstat (limited to 'vcl/source/gdi/impbmp.cxx')
-rw-r--r--vcl/source/gdi/impbmp.cxx3
1 files changed, 2 insertions, 1 deletions
diff --git a/vcl/source/gdi/impbmp.cxx b/vcl/source/gdi/impbmp.cxx
index b79b0d446aca..ad1eca9515be 100644
--- a/vcl/source/gdi/impbmp.cxx
+++ b/vcl/source/gdi/impbmp.cxx
@@ -76,7 +76,8 @@ Size ImpBitmap::ImplGetSize() const
sal_uInt16 ImpBitmap::ImplGetBitCount() const
{
sal_uInt16 nBitCount = mpSalBitmap->GetBitCount();
- return( ( nBitCount <= 1 ) ? 1 : ( nBitCount <= 4 ) ? 4 : ( nBitCount <= 8 ) ? 8 : 24 );
+ return ( nBitCount <= 4 ) ? ( ( nBitCount <= 1 ) ? 1 : 4 ):
+ ( ( nBitCount <= 8 ) ? 8 : 24);
}
BitmapBuffer* ImpBitmap::ImplAcquireBuffer( BitmapAccessMode nMode )