Rounding "error" in Bezier2Polyline (graphmath.pp)
Original Reporter info from Mantis: JoshyFun @joshyfun
-
Reporter name: José Mejuto
Original Reporter info from Mantis: JoshyFun @joshyfun
- Reporter name: José Mejuto
Description:
I'm using FPC 2.2.3 and seems than in 2.2.4 the Round behavior has been changed, and some graphical round operations now are "wrong", that ones that are painted to a X.5 position where previously where painted to X+1 and now are painted to X if X is even or X+1 if X is odd.
The effect is clear in the RoundRect function in the LCL which dimensions (one painted) will be only even in around 1/5 of the cases.
Steps to reproduce:
Put a TShape in a form using GTK2 widgetset, select the RoundRect shape and give a height and width of 100 pixels, you will see that bottom and right line is being draw one pixel less than expected.
If you set a width and height of 99 the lines are at the same position as using 100 as dimensions.
Additional information:
The round "error" is in the AddPoint of Bezier2Polyline where:
procedure AddPoint(const Point : TFloatPoint);
var
P : TPoint;
begin
P := Point;
This performs a Round and the draw point at 99.5 is converted to 99 instead to 100.
This effect is not present in the Widgetsets with native RoundRect like Win32 or QT.
Mantis conversion info:
- Mantis ID: 13259
- OS: Windows
- OS Build: WinXP SP2
- Build: 18841
- Platform: Windows
- Version: 0.9.27 (SVN)
- Fixed in version: 0.9.27 (SVN)
- Fixed in revision: 18862 (#d45af9b5)
- Target version: 0.9.28