mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 17:49:13 +02:00
* fix compilation with 1.0 compiler
This commit is contained in:
parent
40d5c5ede4
commit
d46a1171c2
@ -103,14 +103,31 @@ end;
|
||||
|
||||
procedure TFPReaderBMP.SetupRead(nPalette, nRowBits: Integer; Stream : TStream);
|
||||
|
||||
{$ifdef VER1_0}
|
||||
type
|
||||
tcolinfo = ARRAY [0..0] OF TColorRGBA;
|
||||
pcolinfo = ^tcolinfo;
|
||||
var
|
||||
ColInfo: pcolinfo;
|
||||
{$else}
|
||||
var
|
||||
ColInfo: ARRAY OF TColorRGBA;
|
||||
{$endif}
|
||||
i: Integer;
|
||||
|
||||
begin
|
||||
if nPalette>0 then
|
||||
begin
|
||||
GetMem(FPalette, nPalette*SizeOf(TFPColor));
|
||||
{$ifdef VER1_0}
|
||||
GetMem(ColInfo, nPalette*Sizeof(TColorRGBA));
|
||||
if BFI.ClrUsed>0 then
|
||||
Stream.Read(ColInfo^[0],BFI.ClrUsed*SizeOf(TColorRGBA))
|
||||
else // Seems to me that this is dangerous.
|
||||
Stream.Read(ColInfo^[0],nPalette*SizeOf(TColorRGBA));
|
||||
for i := 0 to nPalette-1 do
|
||||
FPalette[i] := RGBAToFPColor(ColInfo^[i]);
|
||||
{$else}
|
||||
SetLength(ColInfo, nPalette);
|
||||
if BFI.ClrUsed>0 then
|
||||
Stream.Read(ColInfo[0],BFI.ClrUsed*SizeOf(TColorRGBA))
|
||||
@ -118,11 +135,15 @@ begin
|
||||
Stream.Read(ColInfo[0],nPalette*SizeOf(TColorRGBA));
|
||||
for i := 0 to High(ColInfo) do
|
||||
FPalette[i] := RGBAToFPColor(ColInfo[i]);
|
||||
{$endif}
|
||||
end
|
||||
else if BFI.ClrUsed>0 then { Skip palette }
|
||||
Stream.Position := Stream.Position + BFI.ClrUsed*SizeOf(TColorRGBA);
|
||||
ReadSize:=((nRowBits + 31) div 32) shl 2;
|
||||
GetMem(LineBuf,ReadSize);
|
||||
{$ifdef VER1_0}
|
||||
FreeMem(ColInfo, nPalette*Sizeof(TColorRGBA));
|
||||
{$endif}
|
||||
end;
|
||||
|
||||
procedure TFPReaderBMP.InternalRead(Stream:TStream; Img:TFPCustomImage);
|
||||
@ -220,7 +241,10 @@ initialization
|
||||
end.
|
||||
{
|
||||
$Log$
|
||||
Revision 1.10 2004-02-20 23:12:57 michael
|
||||
Revision 1.11 2004-02-25 02:36:51 pierre
|
||||
* fix compilation with 1.0 compiler
|
||||
|
||||
Revision 1.10 2004/02/20 23:12:57 michael
|
||||
+ Read/WriteScanline virtual, as intended
|
||||
|
||||
Revision 1.9 2004/02/20 23:07:44 michael
|
||||
|
Loading…
Reference in New Issue
Block a user