* Fix from Ocean for reading PNG (26538)

git-svn-id: trunk@30290 -
This commit is contained in:
michael 2015-03-23 15:44:43 +00:00
parent 0d3cd8c402
commit ac3aa6b602

View File

@ -403,20 +403,24 @@ end;
function TFPReaderPNG.CalcColor: TColorData;
var cd : longword;
r : word;
b : byte;
tmp : pbytearray;
b : pbyte;
begin
if UsingBitGroup = 0 then
begin
Databytes := 0;
if Header.BitDepth = 16 then
begin
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);
b := @Databytes;
b^ := 0;
r := 0;
while (r < ByteWidth-1) do
begin
b^ := FCurrentLine^[DataIndex+r+1];
inc (b);
b^ := FCurrentLine^[DataIndex+r];
inc (b);
inc (r,2);
end;
end
else move (FCurrentLine^[DataIndex], Databytes, bytewidth);
{$IFDEF ENDIAN_BIG}