From 7712fe37951c62f033a7c48103d00cab6ee5db13 Mon Sep 17 00:00:00 2001 From: paul Date: Tue, 2 Sep 2008 01:21:55 +0000 Subject: [PATCH] wince: fix CreateDIBSectionFromDescription for mono bitmaps (#0011911) git-svn-id: trunk@16362 - --- lcl/interfaces/wince/winceproc.pp | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/lcl/interfaces/wince/winceproc.pp b/lcl/interfaces/wince/winceproc.pp index 5943ff0d38..aea5103545 100644 --- a/lcl/interfaces/wince/winceproc.pp +++ b/lcl/interfaces/wince/winceproc.pp @@ -731,11 +731,18 @@ begin then Info.Header.biCompression := BI_BITFIELDS else Info.Header.biCompression := BI_RGB; - // when 24bpp, CE only supports B8G8R8 encoding - // TODO: check the description - Info.Colors[0] := GetMask(ADesc.RedPrec, ADesc.RedShift); - Info.Colors[1] := GetMask(ADesc.GreenPrec, ADesc.GreenShift); - Info.Colors[2] := GetMask(ADesc.BluePrec, ADesc.BlueShift); + if ADesc.BitsPerPixel = 1 + then begin + // mono bitmap: first color is black, second is white + Info.Colors[1] := $FFFFFFFF; + end + else begin + // when 24bpp, CE only supports B8G8R8 encoding + // TODO: check the description + Info.Colors[0] := GetMask(ADesc.RedPrec, ADesc.RedShift); + Info.Colors[1] := GetMask(ADesc.GreenPrec, ADesc.GreenShift); + Info.Colors[2] := GetMask(ADesc.BluePrec, ADesc.BlueShift); + end; // Use createDIBSection, since only devicedepth bitmaps can be selected into a DC // when they are created with createDIBitmap