Gtk2: fixed bitmap creation when ratio DataSize/MaskSize have remainder. issue #41070

This commit is contained in:
Željan Rikalo 2024-11-21 19:52:47 +01:00
parent 1cedb15355
commit ea838aa496

View File

@ -341,8 +341,8 @@ begin
Inc(DstRowPtr, Rowstride); Inc(DstRowPtr, Rowstride);
Dec(y); Dec(y);
end; end;
end end else
else begin begin
// components are in place // components are in place
// gtkPixbuf doesn't like invalid dataSize/MaskSize < 32. issue #8553. // gtkPixbuf doesn't like invalid dataSize/MaskSize < 32. issue #8553.
@ -352,7 +352,7 @@ begin
ADivResult := 0; ADivResult := 0;
ARemainder := 0; ARemainder := 0;
DivMod(ARawImage.DataSize, ARawImage.MaskSize, ADivResult, ARemainder); DivMod(ARawImage.DataSize, ARawImage.MaskSize, ADivResult, ARemainder);
CreateWithAlpha := ARemainder = 0; CreateWithAlpha := (ARemainder = 0) and ARawImage.IsMasked(True);
{$IFDEF VerboseRawImage} {$IFDEF VerboseRawImage}
if not CreateWithAlpha then if not CreateWithAlpha then
DebugLn('TGtk2WidgetSet.CreateBitmapFromRawImage B WARNING: This image have invalid DataSize / MaskSize.'); DebugLn('TGtk2WidgetSet.CreateBitmapFromRawImage B WARNING: This image have invalid DataSize / MaskSize.');