mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-24 12:21:47 +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;
|
var cd : longword;
|
||||||
r : word;
|
r : word;
|
||||||
b : byte;
|
b : byte;
|
||||||
|
tmp : pbytearray;
|
||||||
begin
|
begin
|
||||||
if UsingBitGroup = 0 then
|
if UsingBitGroup = 0 then
|
||||||
begin
|
begin
|
||||||
Databytes := 0;
|
Databytes := 0;
|
||||||
if Header.BitDepth = 16 then
|
if Header.BitDepth = 16 then
|
||||||
begin
|
begin
|
||||||
r := 1;
|
getmem(tmp, bytewidth);
|
||||||
while (r < ByteWidth) do
|
fillchar(tmp^, bytewidth, 0);
|
||||||
begin
|
for r:=0 to bytewidth-2 do
|
||||||
b := FCurrentLine^[Dataindex+r];
|
tmp^[r+1]:=FCurrentLine^[Dataindex+r];
|
||||||
FCurrentLine^[Dataindex+r] := FCurrentLine^[Dataindex+r-1];
|
move (tmp^[0], Databytes, bytewidth);
|
||||||
FCurrentLine^[Dataindex+r-1] := b;
|
freemem(tmp);
|
||||||
inc (r,2);
|
end
|
||||||
end;
|
else move (FCurrentLine^[DataIndex], Databytes, bytewidth);
|
||||||
end;
|
|
||||||
move (FCurrentLine^[DataIndex], Databytes, bytewidth);
|
|
||||||
{$IFDEF ENDIAN_BIG}
|
{$IFDEF ENDIAN_BIG}
|
||||||
Databytes:=swap(Databytes);
|
Databytes:=swap(Databytes);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user