diff --git a/lcl/graphics.pp b/lcl/graphics.pp index d5897366a6..d660c3ea52 100644 --- a/lcl/graphics.pp +++ b/lcl/graphics.pp @@ -2275,6 +2275,14 @@ begin DstImage.CopyPixels(SrcImage, 0, 0, True, $8000); end else begin + // update DevDesc because of unusual bitmaps. issue #12362 + // widgetset can provide same DevDesc, but also can change it + // like gtk/gtk2 does since it expects XBM format for mono bitmaps. + if DevDesc.Depth = 1 then + begin + QueryFlags := QueryFlags + [riqfUpdate]; + QueryDescription(DevDesc, QueryFlags); + end; DstImage.DataDescription := DevDesc; DstImage.CopyPixels(SrcImage); end; diff --git a/lcl/interfaces/gtk/gtklclintf.inc b/lcl/interfaces/gtk/gtklclintf.inc index 31f4be52a2..016836cb3d 100644 --- a/lcl/interfaces/gtk/gtklclintf.inc +++ b/lcl/interfaces/gtk/gtklclintf.inc @@ -562,8 +562,12 @@ begin Result := RawImage_DescriptionFromDrawable(Desc, nil, riqfAlpha in AFlags); if not Result then Exit; - if not (riqfUpdate in AFlags) - then ADesc.Init; + if not (riqfUpdate in AFlags) then + ADesc.Init; + + // if there's mask gtk assumes it's rgba (not XBM format).issue #12362 + if (riqfUpdate in AFlags) and (riqfMono in AFlags) and (riqfMask in AFlags) then + AFlags := AFlags - [riqfMono] + [riqfRgb]; if riqfMono in AFlags then begin diff --git a/lcl/interfaces/gtk2/gtk2lclintf.inc b/lcl/interfaces/gtk2/gtk2lclintf.inc index 528500e38a..cf849f4b7b 100644 --- a/lcl/interfaces/gtk2/gtk2lclintf.inc +++ b/lcl/interfaces/gtk2/gtk2lclintf.inc @@ -581,13 +581,9 @@ begin if not (riqfUpdate in AFlags) then ADesc.Init; - // if there's mask gtk2 assumes it's rgba. issue #12362 - // Zeljko: removed since it totally crashes shaped controls - - // see examples/shapedcontrols. - { - if (riqfMono in AFlags) and (riqfMask in AFlags) and - (Desc.BitsPerPixel = 32) then - AFlags := AFlags - [riqfMono] + [riqfRgb];} + // if there's mask gtk2 assumes it's rgba (not XBM format).issue #12362 + if (riqfUpdate in AFlags) and (riqfMono in AFlags) and (riqfMask in AFlags) then + AFlags := AFlags - [riqfMono] + [riqfRgb]; if riqfMono in AFlags then begin