mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 04:59:08 +02:00
LCL: improved bit table MissingBits for converting less bits per channel to many bits per channel from Tom Gregorovic
git-svn-id: trunk@10155 -
This commit is contained in:
parent
6bd238fd52
commit
29a270df3c
@ -821,32 +821,37 @@ var
|
|||||||
Prec: Integer;
|
Prec: Integer;
|
||||||
HighValue: word;
|
HighValue: word;
|
||||||
Bits: word;
|
Bits: word;
|
||||||
CurShift: Integer;
|
CurShift, DShift: Integer;
|
||||||
begin
|
begin
|
||||||
for Prec:=0 to 15 do begin
|
for Prec := 0 to 15 do
|
||||||
For HighValue:=0 to 7 do begin
|
begin
|
||||||
|
for HighValue := 0 to 7 do
|
||||||
|
begin
|
||||||
// Value represents the three highest bits
|
// Value represents the three highest bits
|
||||||
// For example:
|
// For example:
|
||||||
// Prec=5 and the read value is %10110
|
// Prec=5 and the read value is %10110
|
||||||
// => Value=%101
|
// => Value=%101
|
||||||
if Prec=0 then begin
|
|
||||||
MissingBits[Prec,HighValue]:=0;
|
|
||||||
continue;
|
|
||||||
end;
|
|
||||||
// copy the value till all missing bits are set
|
// copy the value till all missing bits are set
|
||||||
// For example:
|
// For example:
|
||||||
// Prec=5, HighValue=%110
|
// Prec=5, HighValue=%110
|
||||||
// => MissingBits[5,6]:=%0000011011011011
|
// => MissingBits[5,6]:=%0000011011011011
|
||||||
Bits:=HighValue;
|
MissingBits[Prec, HighValue] := 0;
|
||||||
if Prec<3 then
|
if Prec = 0 then Continue;
|
||||||
// for Precision 1 and 2 the high bits are less
|
if Prec >= 3 then DShift := 3
|
||||||
Bits:=Bits shr (3-Prec);
|
else DShift := Prec;
|
||||||
MissingBits[Prec,HighValue]:=0;
|
|
||||||
CurShift:=16-Prec;
|
Bits := HighValue;
|
||||||
while CurShift>0 do begin
|
|
||||||
MissingBits[Prec,HighValue]:=
|
CurShift := 16 - Prec;
|
||||||
MissingBits[Prec,HighValue] or (Bits shl CurShift);
|
while CurShift > 0 do
|
||||||
dec(CurShift,Prec);
|
begin
|
||||||
|
if CurShift >= DShift then
|
||||||
|
MissingBits[Prec, HighValue] :=
|
||||||
|
MissingBits[Prec, HighValue] or (Bits shl (CurShift - DShift))
|
||||||
|
else
|
||||||
|
MissingBits[Prec, HighValue] :=
|
||||||
|
MissingBits[Prec, HighValue] or (Bits shr (DShift - CurShift));
|
||||||
|
Dec(CurShift, DShift);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
@ -301,6 +301,7 @@ var
|
|||||||
Mess: TLMActivate;
|
Mess: TLMActivate;
|
||||||
begin
|
begin
|
||||||
Result:= True;
|
Result:= True;
|
||||||
|
DebugLn(['gtkactivateCB ',DbgSName(TControl(Data))]);
|
||||||
{$IFDEF EventTrace}
|
{$IFDEF EventTrace}
|
||||||
EventTrace('activate', data);
|
EventTrace('activate', data);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
Loading…
Reference in New Issue
Block a user