I working on a code conversion from Windows to Linux and have an odd problem I can't fix. The program works with images and requires a horizontal and vertical flip of an Timage. It works in Window but not under Linux (fpc 3.0.2 and 3.0.4). I have impression the CopyRect doesn't work. Below my routine. Why doesn't it work in Linux and how to fix?
procedure Tmainwindow.Fliphorizontal1Click(Sender: TObject);
var src, dest: TRect;
bmp: TBitmap;
w, h: integer;
begin
w:=image1.Picture.Width; h:=image1.Picture.Height;
dest:=bounds(0, 0, w, h);
//src:=rect(0, h, w, 0); // Vertical flip
src:=rect(w, 0, 0, h); // Horizontal flip
//src:=rect(w, h, 0, 0); // Both flip
bmp:=TBitmap.Create;
bmp.PixelFormat:=pf24bit;
bmp.SetSize(w, h);
bmp.Canvas.Draw(0, 0, image1.Picture.Bitmap);
image1.Picture.Bitmap.Canvas.CopyRect(dest, bmp.Canvas, src);
bmp.Free;
end;