Windows: Fix rounding error in BitmapInfoHeader calculation
A potential rounding error in calculating the padded scanline length could lead to the biSizeImage field being assigned a too small value. Fixes: QTBUG-133782 Pick-to: 6.9 6.8 6.5 Change-Id: I251212cf2859f7268fc8ad6ca1cbc57f2bb1f1c0 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
parent
4174f388e6
commit
3d389ee2ac
@ -48,7 +48,8 @@ static inline void initBitMapInfoHeader(int width, int height, bool topToBottom,
|
||||
bih->biBitCount = WORD(bitCount);
|
||||
bih->biCompression = compression;
|
||||
// scan lines are word-aligned (unless RLE)
|
||||
const DWORD bytesPerLine = pad4(DWORD(width) * bitCount / 8);
|
||||
const DWORD bytesPerLine = bitCount == 1 ? pad4(DWORD(qCeil(width / 8.0)))
|
||||
: pad4(DWORD(width) * bitCount / 8);
|
||||
bih->biSizeImage = bytesPerLine * DWORD(height);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user