Gtk2: fixed painting of mono bitmaps, gtk2 assumes that bmp + mask = rgba. issue #12362

git-svn-id: trunk@35281 -
This commit is contained in:
zeljko 2012-02-10 08:13:15 +00:00
parent 96b5badde1
commit be493b8d7e

View File

@ -562,14 +562,14 @@ function TGtk2WidgetSet.RawImage_QueryDescription(AFlags: TRawImageQueryFlags; v
var var
Desc: TRawImageDescription; Desc: TRawImageDescription;
begin begin
if riqfGrey in AFlags if riqfGrey in AFlags then
then begin begin
DebugLn('TGtk2WidgetSet.RawImage_QueryDescription: riqfGrey not (yet) supported'); DebugLn('TGtk2WidgetSet.RawImage_QueryDescription: riqfGrey not (yet) supported');
Exit(False); Exit(False);
end; end;
if riqfPalette in AFlags if riqfPalette in AFlags then
then begin begin
DebugLn('TGtk2WidgetSet.RawImage_QueryDescription: riqfPalette not (yet) supported'); DebugLn('TGtk2WidgetSet.RawImage_QueryDescription: riqfPalette not (yet) supported');
Exit(False); Exit(False);
end; end;
@ -578,11 +578,16 @@ begin
Result := RawImage_DescriptionFromDrawable(Desc, nil, riqfAlpha in AFlags); Result := RawImage_DescriptionFromDrawable(Desc, nil, riqfAlpha in AFlags);
if not Result then Exit; if not Result then Exit;
if not (riqfUpdate in AFlags) if not (riqfUpdate in AFlags) then
then ADesc.Init; ADesc.Init;
if riqfMono in AFlags // if there's mask gtk2 assumes it's rgba. issue #12362
then begin if (riqfMono in AFlags) and (riqfMask in AFlags) and
(Desc.BitsPerPixel = 32) then
AFlags := AFlags - [riqfMono] + [riqfRgb];
if riqfMono in AFlags then
begin
ADesc.Format := ricfGray; ADesc.Format := ricfGray;
ADesc.Depth := 1; ADesc.Depth := 1;
ADesc.BitOrder := Desc.MaskBitOrder; ADesc.BitOrder := Desc.MaskBitOrder;
@ -598,7 +603,7 @@ begin
ADesc.BluePrec := 1; ADesc.BluePrec := 1;
ADesc.BlueShift := Desc.MaskShift; ADesc.BlueShift := Desc.MaskShift;
end end
(* (*
//TODO //TODO
else if riqfGrey in AFlags else if riqfGrey in AFlags
then begin then begin
@ -612,9 +617,10 @@ begin
ADesc.RedPrec := 8; ADesc.RedPrec := 8;
ADesc.RedShift := 0; ADesc.RedShift := 0;
end end
*) *)
else if riqfRGB in AFlags else
then begin if riqfRGB in AFlags then
begin
ADesc.Format := ricfRGBA; ADesc.Format := ricfRGBA;
ADesc.Depth := Desc.Depth; ADesc.Depth := Desc.Depth;
ADesc.BitOrder := Desc.BitOrder; ADesc.BitOrder := Desc.BitOrder;
@ -630,14 +636,14 @@ begin
ADesc.BlueShift := Desc.BlueShift; ADesc.BlueShift := Desc.BlueShift;
end; end;
if riqfAlpha in AFlags if riqfAlpha in AFlags then
then begin begin
ADesc.AlphaPrec := Desc.AlphaPrec; ADesc.AlphaPrec := Desc.AlphaPrec;
ADesc.AlphaShift := Desc.AlphaShift; ADesc.AlphaShift := Desc.AlphaShift;
end; end;
if riqfMask in AFlags if riqfMask in AFlags then
then begin begin
ADesc.MaskBitsPerPixel := Desc.MaskBitsPerPixel; ADesc.MaskBitsPerPixel := Desc.MaskBitsPerPixel;
ADesc.MaskShift := Desc.MaskShift; ADesc.MaskShift := Desc.MaskShift;
ADesc.MaskLineEnd := Desc.MaskLineEnd; ADesc.MaskLineEnd := Desc.MaskLineEnd;