mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 20:09:20 +02:00
* Fix from Ocean for reading PNG (26538)
git-svn-id: trunk@30290 -
This commit is contained in:
parent
0d3cd8c402
commit
ac3aa6b602
@ -403,20 +403,24 @@ end;
|
|||||||
function TFPReaderPNG.CalcColor: TColorData;
|
function TFPReaderPNG.CalcColor: TColorData;
|
||||||
var cd : longword;
|
var cd : longword;
|
||||||
r : word;
|
r : word;
|
||||||
b : byte;
|
b : pbyte;
|
||||||
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
|
||||||
getmem(tmp, bytewidth);
|
b := @Databytes;
|
||||||
fillchar(tmp^, bytewidth, 0);
|
b^ := 0;
|
||||||
for r:=0 to bytewidth-2 do
|
r := 0;
|
||||||
tmp^[r+1]:=FCurrentLine^[Dataindex+r];
|
while (r < ByteWidth-1) do
|
||||||
move (tmp^[0], Databytes, bytewidth);
|
begin
|
||||||
freemem(tmp);
|
b^ := FCurrentLine^[DataIndex+r+1];
|
||||||
|
inc (b);
|
||||||
|
b^ := FCurrentLine^[DataIndex+r];
|
||||||
|
inc (b);
|
||||||
|
inc (r,2);
|
||||||
|
end;
|
||||||
end
|
end
|
||||||
else move (FCurrentLine^[DataIndex], Databytes, bytewidth);
|
else move (FCurrentLine^[DataIndex], Databytes, bytewidth);
|
||||||
{$IFDEF ENDIAN_BIG}
|
{$IFDEF ENDIAN_BIG}
|
||||||
|
Loading…
Reference in New Issue
Block a user