Gtk, Gtk2: update rawimage description when we are about 1bpp since gtk/gtk2 expects XBM format for 1bpp bitmaps, otherwise it crashes. issue #12362

git-svn-id: trunk@35502 -
This commit is contained in:
zeljko 2012-02-20 07:57:55 +00:00
parent 19acb2a8de
commit 1b0fc1ad3d
3 changed files with 17 additions and 9 deletions

View File

@ -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;

View File

@ -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

View File

@ -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