mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-27 10:20:19 +02:00
GTK3: Fixed rendering of images using 24 bits per pixel.
Closes: #40374. Thanks To: Anton Kavalenka. When the image is stored in a buffer using 24 bits per pixel, we don't need to copy pixel by pixel unless the components order is wrong. We can use `System.move` in this case. This is the same thing that is used for 32 bit images.
This commit is contained in:
parent
5c5693e6be
commit
fa8e8eeecf
@ -230,6 +230,44 @@ begin
|
||||
|
||||
GetMem(NewData, ArawImage.DataSize);
|
||||
|
||||
if desc.BitsPerPixel = 1 then
|
||||
begin
|
||||
DbgS('Bit depth not implemented '+inttostr(desc.BitsPerPixel));
|
||||
end
|
||||
else if desc.BitsPerPixel = 8 then
|
||||
begin
|
||||
DbgS('Bit depth not implemented '+inttostr(desc.BitsPerPixel));
|
||||
end
|
||||
else if desc.BitsPerPixel = 16 then
|
||||
begin
|
||||
DbgS('Bit depth not implemented '+inttostr(desc.BitsPerPixel));
|
||||
end
|
||||
else if (desc.BitsPerPixel = 24) and ((Ridx <> 0) or (Gidx <> 1) or (Bidx <> 2) or (AIdx <> 3)) then
|
||||
begin
|
||||
// put components in right order
|
||||
DstRowPtr := NewData;
|
||||
SrcRowPtr := ArawImage.Data;
|
||||
y := Desc.Height;
|
||||
while y > 0 do
|
||||
begin
|
||||
Src := SrcRowPtr;
|
||||
Dst := DstRowPtr;
|
||||
x := Desc.Width;
|
||||
while x > 0 do
|
||||
begin
|
||||
Dst[0] := Src[Ridx];
|
||||
Dst[1] := Src[Gidx];
|
||||
Dst[2] := Src[Bidx];
|
||||
|
||||
Inc(Src, 3);
|
||||
Inc(Dst, 3);
|
||||
Dec(x);
|
||||
end;
|
||||
Inc(SrcRowPtr, ARowstride);
|
||||
Inc(DstRowPtr, ARowstride);
|
||||
Dec(y);
|
||||
end;
|
||||
end else
|
||||
if (Ridx <> 0) or (Gidx <> 1) or (Bidx <> 2) or (AIdx <> 3) then
|
||||
begin
|
||||
// put components in right order
|
||||
|
Loading…
Reference in New Issue
Block a user