Recent

Author Topic: Version 2.2.0 RC2 Arm Linux using calculations in function call?  (Read 3160 times)

jdp

  • Full Member
  • ***
  • Posts: 144
Hi all. I have been using version 2.1.0 on Arm Linux on the Raspberry Pi without issues. I have now build a new 8GB Dev Pi and installed first 2.3.0 Trunk and now 2.2.0 RC2. In both versions, I have issues with some of the BGRA Controls. I did log an issue on the developer's Git page.

https://github.com/bgrabitmap/bgracontrols/issues/113

I have done some investigation and it seems the issue is with the calculation inside the function call. The datatype the function arc is looking for is a single. Yet the code Height / 2 is a double. If I leave the code like this it seems that the receiving function gets 0 and then it draws the control at the wrong place. But if I change the code to use a variable declared as a single and then I do the calculation before the time using round to ignore the decimal point and use the variable in the call then the control works.

Code: Pascal  [Select][+][-]
  1. temp_height : single;
  2. begin
  3.  
  4. temp_height := round(Height / 2);
  5.  
  6. FreeAndNil(FBitmap);
  7. FBitmap := TBGRABitmap.Create(Width , Height);
  8.  
  9. FBitmap.Canvas2D.beginPath;
  10. //FBitmap.Canvas2D.arc(Width / 2, (Height / 2) , Height / 2.5, 0, pi * 2, False);
  11. FBitmap.Canvas2D.arc((Width / 2), temp_height , Height / 2.5, 0, pi * 2, False);
  12. FBitmap.Canvas2D.fillStyle(Color);
  13. FBitmap.Canvas2D.fill;

So as this code works fine in version 2.1.0 on Arm Linux on the Pi is there something that changed or is there some setting I need to set to make all the old code still work?


jdp

  • Full Member
  • ***
  • Posts: 144
Re: Version 2.2.0 RC2 Arm Linux using calculations in function call?
« Reply #1 on: August 19, 2021, 12:15:43 pm »
So I found a way around it. But still wondering why it is doing this.

rvk

  • Hero Member
  • *****
  • Posts: 6163
Re: Version 2.2.0 RC2 Arm Linux using calculations in function call?
« Reply #2 on: August 19, 2021, 05:06:27 pm »
The strange thing is that the first parameter (Width / 2) and third parameter (Height / 2.5) do not suffer the same effect.

Is Height at the end of that procedure still the correct value?
(so after the FBitmap.Canvas2D.fill line)

 

TinyPortal © 2005-2018