mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 20:49:24 +02:00
Gtk2: fixed painting of mono bitmaps, gtk2 assumes that bmp + mask = rgba. issue #12362
git-svn-id: trunk@35281 -
This commit is contained in:
parent
96b5badde1
commit
be493b8d7e
@ -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;
|
||||||
|
Loading…
Reference in New Issue
Block a user