mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-21 19:05:16 +02:00
* Fix for 16-bit PNGs (bug 19209)
git-svn-id: trunk@22141 -
This commit is contained in:
parent
1c32e34395
commit
1beea17ed2
@ -404,22 +404,21 @@ function TFPReaderPNG.CalcColor: TColorData;
|
||||
var cd : longword;
|
||||
r : word;
|
||||
b : byte;
|
||||
tmp : pbytearray;
|
||||
begin
|
||||
if UsingBitGroup = 0 then
|
||||
begin
|
||||
Databytes := 0;
|
||||
if Header.BitDepth = 16 then
|
||||
begin
|
||||
r := 1;
|
||||
while (r < ByteWidth) do
|
||||
begin
|
||||
b := FCurrentLine^[Dataindex+r];
|
||||
FCurrentLine^[Dataindex+r] := FCurrentLine^[Dataindex+r-1];
|
||||
FCurrentLine^[Dataindex+r-1] := b;
|
||||
inc (r,2);
|
||||
end;
|
||||
end;
|
||||
move (FCurrentLine^[DataIndex], Databytes, bytewidth);
|
||||
getmem(tmp, bytewidth);
|
||||
fillchar(tmp^, bytewidth, 0);
|
||||
for r:=0 to bytewidth-2 do
|
||||
tmp^[r+1]:=FCurrentLine^[Dataindex+r];
|
||||
move (tmp^[0], Databytes, bytewidth);
|
||||
freemem(tmp);
|
||||
end
|
||||
else move (FCurrentLine^[DataIndex], Databytes, bytewidth);
|
||||
{$IFDEF ENDIAN_BIG}
|
||||
Databytes:=swap(Databytes);
|
||||
{$ENDIF}
|
||||
|
Loading…
Reference in New Issue
Block a user