GTK3 speedbuttons display bad images
- Lazarus/FPC Version: lazarus_main
- Operating System: Linux
- CPU / Bitness: 64 (64 or 32 Bit?)
What happens
In gtk3, speedbuttons do not show their bitmaps correctly.
What did you expect
Correctly rendered bitmaps.
Steps to reproduce
Blank form, add a speedbutton, set a bitmap file and run it.
The issue was introduced in 02115d37, "LCL-GTK3: Turn WriteLn into DebugLn. Make sure they compile. Cleanup." and relates to gtk3lclintf.inc. Changes in 02115d37 enabled some extra formats but they appear to be in a different order than that defined in the bindings, gtk3bindings/lazcairo1.pas.
Around line 306 the function TGtk3WidgetSet.RawImage_DescriptionFromBitmap() should look like this -
function TGtk3WidgetSet.RawImage_DescriptionFromBitmap(ABitmap: HBITMAP; out ADesc: TRawImageDescription): boolean;
// var
// GDIObject: PGDIObject absolute ABitmap;
const
CairoImageFormatToDepth: array[cairo_format_t] of integer =
(
{CAIRO_FORMAT_INVALID} -1,
{CAIRO_FORMAT_ARGB32} 32,
{CAIRO_FORMAT_RGB24} 24,
{CAIRO_FORMAT_A8} 8,
{CAIRO_FORMAT_A1} 1,
{CAIRO_FORMAT_RGB16_565} 16,
{CAIRO_FORMAT_RGB30} 15
);
This matter was discussed in the tail end of https://forum.lazarus.freepascal.org/index.php/topic,50400.0.html
Patch or pull request can be provided if you need it.
Davo