diff options
author | michael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2015-03-23 15:44:43 +0000 |
---|---|---|
committer | michael <michael@3ad0048d-3df7-0310-abae-a5850022a9f2> | 2015-03-23 15:44:43 +0000 |
commit | 532f84b998545473072f9b85323f1a1fc35df90b (patch) | |
tree | ea0c8fbcfb30224dbf3685a1e35226eeb44818ce | |
parent | fc2f6bf98948b5ba1b3a9c0195d5618eeb200374 (diff) | |
download | fpc-532f84b998545473072f9b85323f1a1fc35df90b.tar.gz |
* Fix from Ocean for reading PNG (26538)
git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@30290 3ad0048d-3df7-0310-abae-a5850022a9f2
-rw-r--r-- | packages/fcl-image/src/fpreadpng.pp | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/packages/fcl-image/src/fpreadpng.pp b/packages/fcl-image/src/fpreadpng.pp index af204af144..379dd4be50 100644 --- a/packages/fcl-image/src/fpreadpng.pp +++ b/packages/fcl-image/src/fpreadpng.pp @@ -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} |