mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-12-03 15:07:29 +01:00
LCL IntfGraphics: fixed bug #0011109: Bitmap "Invalid Size" error. - Mac OS X - Leopard
- negative height in bmp header only means bitmap data is not upside-down git-svn-id: trunk@14792 -
This commit is contained in:
parent
b82d4957ca
commit
beec66d795
@ -4654,7 +4654,8 @@ begin
|
|||||||
|
|
||||||
{ This will move past any junk after the BFI header }
|
{ This will move past any junk after the BFI header }
|
||||||
TheStream.Position := TheStream.Position + TStreamSeekType(BFI.biSize-SizeOf(BFI));
|
TheStream.Position := TheStream.Position + TStreamSeekType(BFI.biSize-SizeOf(BFI));
|
||||||
TheImage.SetSize(BFI.biWidth, BFI.biHeight);
|
TheImage.SetSize(BFI.biWidth, Abs(BFI.biHeight));
|
||||||
|
// Note for Abs - height can be negative if bitmap data is not stored upside-down
|
||||||
FBitsPerPixel := BFI.biBitCount;
|
FBitsPerPixel := BFI.biBitCount;
|
||||||
|
|
||||||
case BFI.biBitCount of
|
case BFI.biBitCount of
|
||||||
@ -4765,13 +4766,21 @@ begin
|
|||||||
Row := TheImage.Height - 1;
|
Row := TheImage.Height - 1;
|
||||||
ReadScanLine(Row);
|
ReadScanLine(Row);
|
||||||
SaveTransparentColor;
|
SaveTransparentColor;
|
||||||
WriteScanLine(Row);
|
|
||||||
|
if BFI.biHeight > 0 then
|
||||||
|
WriteScanLine(Row) // upside-down
|
||||||
|
else
|
||||||
|
WriteScanLine(TheImage.Height - 1 - Row);
|
||||||
|
|
||||||
while Row > 0 do
|
while Row > 0 do
|
||||||
begin
|
begin
|
||||||
Dec(Row);
|
Dec(Row);
|
||||||
ReadScanLine(Row); // Scanline in LineBuf with Size ReadSize.
|
ReadScanLine(Row); // Scanline in LineBuf with Size ReadSize.
|
||||||
WriteScanLine(Row);
|
|
||||||
|
if BFI.biHeight > 0 then
|
||||||
|
WriteScanLine(Row) // upside-down
|
||||||
|
else
|
||||||
|
WriteScanLine(TheImage.Height - 1 - Row);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
FreeBufs;
|
FreeBufs;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user