mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-14 13:49:21 +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);
|
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
|
var
|
||||||
ColInfo: ARRAY OF TColorRGBA;
|
ColInfo: ARRAY OF TColorRGBA;
|
||||||
|
{$endif}
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if nPalette>0 then
|
if nPalette>0 then
|
||||||
begin
|
begin
|
||||||
GetMem(FPalette, nPalette*SizeOf(TFPColor));
|
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);
|
SetLength(ColInfo, nPalette);
|
||||||
if BFI.ClrUsed>0 then
|
if BFI.ClrUsed>0 then
|
||||||
Stream.Read(ColInfo[0],BFI.ClrUsed*SizeOf(TColorRGBA))
|
Stream.Read(ColInfo[0],BFI.ClrUsed*SizeOf(TColorRGBA))
|
||||||
@ -118,11 +135,15 @@ begin
|
|||||||
Stream.Read(ColInfo[0],nPalette*SizeOf(TColorRGBA));
|
Stream.Read(ColInfo[0],nPalette*SizeOf(TColorRGBA));
|
||||||
for i := 0 to High(ColInfo) do
|
for i := 0 to High(ColInfo) do
|
||||||
FPalette[i] := RGBAToFPColor(ColInfo[i]);
|
FPalette[i] := RGBAToFPColor(ColInfo[i]);
|
||||||
|
{$endif}
|
||||||
end
|
end
|
||||||
else if BFI.ClrUsed>0 then { Skip palette }
|
else if BFI.ClrUsed>0 then { Skip palette }
|
||||||
Stream.Position := Stream.Position + BFI.ClrUsed*SizeOf(TColorRGBA);
|
Stream.Position := Stream.Position + BFI.ClrUsed*SizeOf(TColorRGBA);
|
||||||
ReadSize:=((nRowBits + 31) div 32) shl 2;
|
ReadSize:=((nRowBits + 31) div 32) shl 2;
|
||||||
GetMem(LineBuf,ReadSize);
|
GetMem(LineBuf,ReadSize);
|
||||||
|
{$ifdef VER1_0}
|
||||||
|
FreeMem(ColInfo, nPalette*Sizeof(TColorRGBA));
|
||||||
|
{$endif}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TFPReaderBMP.InternalRead(Stream:TStream; Img:TFPCustomImage);
|
procedure TFPReaderBMP.InternalRead(Stream:TStream; Img:TFPCustomImage);
|
||||||
@ -220,7 +241,10 @@ initialization
|
|||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$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
|
+ Read/WriteScanline virtual, as intended
|
||||||
|
|
||||||
Revision 1.9 2004/02/20 23:07:44 michael
|
Revision 1.9 2004/02/20 23:07:44 michael
|
||||||
|
Loading…
Reference in New Issue
Block a user