mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-07 08:58:23 +02:00
Merge branch 'GtkPartialMerge' into 'main'
GTK3: Fixed rendering of images using 32 bits per pixel. Issue #40337. See merge request freepascal.org/lazarus/lazarus!214
This commit is contained in:
commit
0cae5d4eb7
@ -13,6 +13,7 @@ uses
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
Application.Title := '';
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
|
@ -230,8 +230,7 @@ begin
|
||||
|
||||
GetMem(NewData, ArawImage.DataSize);
|
||||
|
||||
//if (Ridx <> 0) or (Gidx <> 1) or (Bidx <> 2) or (AIdx <> 3) then
|
||||
if desc.Depth=32 then
|
||||
if (Ridx <> 0) or (Gidx <> 1) or (Bidx <> 2) or (AIdx <> 3) then
|
||||
begin
|
||||
// put components in right order
|
||||
|
||||
@ -258,6 +257,8 @@ begin
|
||||
Inc(DstRowPtr, ARowstride);
|
||||
Dec(y);
|
||||
end;
|
||||
end else begin
|
||||
System.Move(ArawImage.Data^, NewData^, ArawImage.DataSize);
|
||||
end;
|
||||
|
||||
end
|
||||
@ -265,11 +266,13 @@ begin
|
||||
NewData := nil;
|
||||
|
||||
// this is only a rough implementation, there is no check against bitsperpixel
|
||||
case Desc.Depth of
|
||||
case Desc.BitsPerPixel of
|
||||
1: ImageFormat := CAIRO_FORMAT_A1;
|
||||
8: ImageFormat := CAIRO_FORMAT_A8;
|
||||
else
|
||||
ImageFormat := CAIRO_FORMAT_ARGB32;
|
||||
24: ImageFormat := CAIRO_FORMAT_RGB24;
|
||||
32: ImageFormat := CAIRO_FORMAT_ARGB32;
|
||||
else
|
||||
Exit(False);
|
||||
end;
|
||||
ARowStride := GetBytesPerLine(Desc.Width, Desc.BitsPerPixel, rileDWordBoundary);
|
||||
ABitmap := HBitmap(TGtk3Image.Create(NewData, Desc.Width, Desc.Height, ARowStride, ImageFormat,
|
||||
|
Loading…
Reference in New Issue
Block a user