LCL-GTK3: Update for swapped R/B colors. Issue #36374, patch from Anton Kavalenka.

git-svn-id: trunk@62842 -
This commit is contained in:
juha 2020-04-01 10:43:20 +00:00
parent b2501a2b9a
commit 01082a807d
6 changed files with 21 additions and 10 deletions

View File

@ -191,9 +191,9 @@ begin
Desc.BluePrec := 8;
Desc.AlphaShift := 24;
Desc.RedShift := 16;
Desc.RedShift := 0;
Desc.GreenShift := 8;
// Desc.BlueShift := 0;
Desc.BlueShift := 16;
// Qt wants dword-aligned data
Desc.MaskLineEnd := rileDWordBoundary;

View File

@ -319,9 +319,9 @@ begin
ADesc.BluePrec := 8;
ADesc.AlphaShift := 24;
ADesc.RedShift := 16;
ADesc.RedShift := 0;
ADesc.GreenShift := 8;
ADesc.BlueShift := 0;
ADesc.BlueShift := 16;
end;
end;
(*

View File

@ -1119,6 +1119,7 @@ constructor TGtk3DeviceContext.Create(AWidget: PGtkWidget;
var
W: gint;
H: gint;
ACairo:pcairo_t;
ARect: TGdkRectangle;
AWindow: PGdkWindow;
x: gint;
@ -1146,15 +1147,22 @@ begin
if AWidget = nil then
begin
AWindow := gdk_get_default_root_window;
(* AWindow := gdk_get_default_root_window;
AWindow^.get_geometry(@x, @y, @w, @h);
w:=1; h:=1;
// ParentPixmap := gdk_pixbuf_get_from_window(AWindow, x, y, w, h);
// Widget := gdk_cairo_create(AWindow);
// gdk_cairo_set_source_pixbuf(Widget, ParentPixmap, 0, 0);
CairoSurface := cairo_image_surface_create(CAIRO_FORMAT_RGB24, w, h);
//CairoSurface := cairo_image_surface_create(CAIRO_FORMAT_RGB24, w, h);
CairoSurface := cairo_image_surface_create(CAIRO_FORMAT_ARGB32, w, h);
Widget := cairo_create(CairoSurface); *)
ACairo := gdk_cairo_create(gdk_get_default_root_window);
gdk_cairo_get_clip_rectangle(ACairo, @ARect);
CairoSurface := cairo_image_surface_create(CAIRO_FORMAT_ARGB32, ARect.width, ARect.height);
Widget := cairo_create(CairoSurface);
ParentPixmap := gdk_pixbuf_get_from_surface(CairoSurface, 0, 0, 1, 1);
ParentPixmap := gdk_pixbuf_get_from_surface(CairoSurface, 0, 0, ARect.width, ARect.height);
FOwnsSurface := True;
end else
begin
@ -1499,6 +1507,9 @@ begin
with targetRect^ do
cairo_rectangle(Widget, Left + PixelOffset, Top + PixelOffset, Right - Left, Bottom - Top);
cairo_set_operator (Widget, CAIRO_OPERATOR_OVER);
cairo_matrix_init_identity(@M);
cairo_matrix_translate(@M, SourceRect^.Left, SourceRect^.Top);
cairo_matrix_scale(@M, (sourceRect^.Right-sourceRect^.Left) / (targetRect^.Right-targetRect^.Left),

View File

@ -4048,7 +4048,7 @@ begin
resolution.GetRawImage(btn.ImageIndex,raw);
{ convince the bitmap it has actually another format }
bmp.BeginUpdate();
raw.Description.Init_BPP32_R8G8B8A8_BIO_TTB(resolution.Width,resolution.Height);
//raw.Description.Init_BPP32_R8G8B8A8_BIO_TTB(resolution.Width,resolution.Height);
bmp.LoadFromRawImage(raw,false);
bmp.EndUpdate();
pb:=TGtk3Image(bmp.Handle).Handle;

View File

@ -4044,7 +4044,7 @@ begin
ATargetRect := Rect(X, Y, Width + X, Height + Y);
ASrcRect := Rect(XSrc, YSrc, SrcWidth + XSrc, SrcHeight + YSrc);
if (DestContext.OwnsSurface) then
if (DestContext.OwnsSurface) and (SrcContext.OwnsSurface) then
DestContext.drawImage1(@ATargetRect, PgdkPixbuf(SrcContext.CurrentImage.Handle) , @ASrcRect, nil, nil)
else
DestContext.drawSurface(@ATargetRect,SrcContext.CairoSurface , @ASrcRect, nil, nil);

View File

@ -137,7 +137,7 @@ begin
resolution.GetRawImage(ABitBtn.ImageIndex,raw);
{ convice the bitmap it has actually another format }
AGlyph.BeginUpdate();
raw.Description.Init_BPP32_R8G8B8A8_BIO_TTB(resolution.Width,resolution.Height);
// raw.Description.Init_BPP32_R8G8B8A8_BIO_TTB(resolution.Width,resolution.Height);
AGlyph.LoadFromRawImage(raw,false);
AGlyph.EndUpdate();
end else