summaryrefslogtreecommitdiff
path: root/src/corelib
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2013-09-23 17:03:05 +0100
committerGraeme Geldenhuys <graemeg@gmail.com>2013-09-23 17:03:05 +0100
commite4592856f24e69bfb7631f9bf6d022058a16d383 (patch)
tree5f45481b74d3f39287de7867d2e2085a2e7673bc /src/corelib
parent660cd7146b24bfa04688ae4aa0b95ff0f6dfd613 (diff)
downloadfpGUI-e4592856f24e69bfb7631f9bf6d022058a16d383.tar.xz
Fixes GitHub Issue #9 (15bit color conversion under X11)
https://github.com/graemeg/fpGUI/issues/9 Thanks to UAPLY for debugging the issue and supplying the solution. Much appreciated.
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/x11/fpg_x11.pas9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas
index 92eaf454..c7a1b865 100644
--- a/src/corelib/x11/fpg_x11.pas
+++ b/src/corelib/x11/fpg_x11.pas
@@ -488,6 +488,13 @@ begin
Result := Result or ((rgb and $F80000) shr 8);
end;
+function ConvertTo555Pixel(rgb: longword): word;
+begin
+ Result := (rgb and $F8) shr 3;
+ Result := Result or ((rgb and $F800) shr 6);
+ Result := Result or ((rgb and $F80000) shr 9);
+end;
+
function fpgColorToX(col: TfpgColor): longword;
var
xc: TXColor;
@@ -499,6 +506,8 @@ begin
Result := c and $FFFFFF { No Alpha channel information }
else if xapplication.DisplayDepth = 16 then
Result := ConvertTo565Pixel(c)
+ else if (xapplication.DisplayDepth = 15) then
+ Result := ConvertTo555Pixel(c)
else
begin
c := col;