mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-19 18:28:20 +02:00
Gtk2: better guess for invalid mask. issue #21616
git-svn-id: trunk@36481 -
This commit is contained in:
parent
69f2bc9bd7
commit
a4f13f7bd2
@ -266,6 +266,7 @@ var
|
|||||||
Src, Dst, SrcRowPtr, DstRowPtr: PByte;
|
Src, Dst, SrcRowPtr, DstRowPtr: PByte;
|
||||||
x, y: Cardinal;
|
x, y: Cardinal;
|
||||||
CreateWithAlpha: boolean;
|
CreateWithAlpha: boolean;
|
||||||
|
ADivResult, ARemainder: DWord;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
ABitmap := 0;
|
ABitmap := 0;
|
||||||
@ -364,7 +365,11 @@ begin
|
|||||||
// gtkPixbuf doesn't like invalid dataSize/MaskSize < 32. issue #8553.
|
// gtkPixbuf doesn't like invalid dataSize/MaskSize < 32. issue #8553.
|
||||||
if (ARawImage.MaskSize > 0) and (ImgDepth = 32) then
|
if (ARawImage.MaskSize > 0) and (ImgDepth = 32) then
|
||||||
begin
|
begin
|
||||||
CreateWithAlpha := Trunc(ARawImage.DataSize / ARawImage.MaskSize) = 32;
|
// seem that gdkPixbuf does not like many of our masks
|
||||||
|
ADivResult := 0;
|
||||||
|
ARemainder := 0;
|
||||||
|
DivMod(ARawImage.DataSize, ARawImage.MaskSize, ADivResult, ARemainder);
|
||||||
|
CreateWithAlpha := ARemainder = 0;
|
||||||
{$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.');
|
||||||
|
Loading…
Reference in New Issue
Block a user