* Fix for bug ID #0022986

git-svn-id: trunk@22460 -
This commit is contained in:
michael 2012-09-26 14:17:31 +00:00
parent 10d4b8e66f
commit 2cd78c03b3

View File

@ -742,27 +742,30 @@ procedure TFPReaderPNG.DoDecompress;
end
else
l := ScanLineLength[rp]*ByteWidth;
GetMem (FPreviousLine, l);
GetMem (FCurrentLine, l);
fillchar (FCurrentLine^,l,0);
try
for ry := 0 to CountScanlines[rp]-1 do
begin
FSwitchLine := FCurrentLine;
FCurrentLine := FPreviousLine;
FPreviousLine := FSwitchLine;
Y := CalcY(ry);
Decompress.Read (lf, sizeof(lf));
Decompress.Read (FCurrentLine^, l);
if lf <> 0 then // Do nothing when there is no filter used
for rx := 0 to l-1 do
FCurrentLine^[rx] := DoFilter (lf, rx, FCurrentLine^[rx]);
HandleScanLine (y, FCurrentLine);
end;
finally
freemem (FPreviousLine);
freemem (FCurrentLine);
end;
if (l>0) then
begin
GetMem (FPreviousLine, l);
GetMem (FCurrentLine, l);
fillchar (FCurrentLine^,l,0);
try
for ry := 0 to CountScanlines[rp]-1 do
begin
FSwitchLine := FCurrentLine;
FCurrentLine := FPreviousLine;
FPreviousLine := FSwitchLine;
Y := CalcY(ry);
Decompress.Read (lf, sizeof(lf));
Decompress.Read (FCurrentLine^, l);
if lf <> 0 then // Do nothing when there is no filter used
for rx := 0 to l-1 do
FCurrentLine^[rx] := DoFilter (lf, rx, FCurrentLine^[rx]);
HandleScanLine (y, FCurrentLine);
end;
finally
freemem (FPreviousLine);
freemem (FCurrentLine);
end;
end;
end;
end;