mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-26 12:23:51 +02: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 }
|
||||
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;
|
||||
|
||||
case BFI.biBitCount of
|
||||
@ -4765,13 +4766,21 @@ begin
|
||||
Row := TheImage.Height - 1;
|
||||
ReadScanLine(Row);
|
||||
SaveTransparentColor;
|
||||
WriteScanLine(Row);
|
||||
|
||||
if BFI.biHeight > 0 then
|
||||
WriteScanLine(Row) // upside-down
|
||||
else
|
||||
WriteScanLine(TheImage.Height - 1 - Row);
|
||||
|
||||
while Row > 0 do
|
||||
begin
|
||||
Dec(Row);
|
||||
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;
|
||||
finally
|
||||
FreeBufs;
|
||||
|
Loading…
Reference in New Issue
Block a user