summaryrefslogtreecommitdiff
path: root/vcl/source/bitmap
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2016-07-10 15:48:11 +0100
committerCaolán McNamara <caolanm@redhat.com>2016-07-10 15:50:25 +0100
commit3749bea854890e916e263b1a3c888d36556430de (patch)
tree5f2d0a1c80aa839170541fe8bfe8fbfac981b0dc /vcl/source/bitmap
parent272e761a13a6f58333cd574831852233e688d934 (diff)
making a disabled image from a 1 bit depth icon gives index asserts
cause the disabled color cannot be mapped to the 2 entries in the palette, so use 8bit dests if the src is 1bit regression from commit 507d0ded64db51a8826d07c507f612a6c02c3869 Author: Caolán McNamara <caolanm@redhat.com> Date: Tue Dec 1 12:18:57 2015 +0000 keep disable image at same depth as original seen when clicking on the image loaded from tdf#100632 Change-Id: Ic69bccfa0fc86707b4fd9e757d8374d80e4b0071
Diffstat (limited to 'vcl/source/bitmap')
-rw-r--r--vcl/source/bitmap/BitmapProcessor.cxx9
1 files changed, 8 insertions, 1 deletions
diff --git a/vcl/source/bitmap/BitmapProcessor.cxx b/vcl/source/bitmap/BitmapProcessor.cxx
index acbac9a83211..91b46bcb8100 100644
--- a/vcl/source/bitmap/BitmapProcessor.cxx
+++ b/vcl/source/bitmap/BitmapProcessor.cxx
@@ -59,7 +59,14 @@ BitmapEx BitmapProcessor::createDisabledImage(const BitmapEx& rBitmapEx)
{
const Size aSize(rBitmapEx.GetSizePixel());
- Bitmap aGrey(aSize, rBitmapEx.GetBitCount());
+ //keep disable image at same depth as original where possible, otherwise
+ //use 8 bit
+ sal_uInt16 nBitCount = rBitmapEx.GetBitCount();
+ if (nBitCount < 8)
+ nBitCount = 8;
+ const BitmapPalette* pPal = nBitCount == 8 ? &Bitmap::GetGreyPalette(256) : nullptr;
+ Bitmap aGrey(aSize, nBitCount, pPal);
+
AlphaMask aGreyAlpha(aSize);
Bitmap aBitmap(rBitmapEx.GetBitmap());