wxPoint ctor rounds instead of truncates (Issue #26099)

14 views
Skip to first unread message

Duncan

unread,
Jan 15, 2026, 7:13:24 AM (21 hours ago) Jan 15
to wx-...@googlegroups.com, Subscribed
duncanspumpkin created an issue (wxWidgets/wxWidgets#26099)

Description

Bug description:

#754 changed the constructor of wxPoint to round instead of truncate when converting from a wxRealPoint. This change is not documented in the change log. The change is now at odds with the documentation for wxPoint that states that it truncates and doesn't round.

Either the documentation should be updated or the change reverted. The change log should also be updated as it has caused a lot of subtle issues when updating code.

Expected vs observed behaviour:

wxRealPoint rp(0.9,0.9);
wxPoint p(rp);

Expected p = 0, 0
Observed p = 1, 1

Platform and version information

  • wxWidgets version you use: 3.2.4 issue has existed since 3.1.2


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26099@github.com>

VZ

unread,
Jan 15, 2026, 8:42:07 AM (19 hours ago) Jan 15
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#26099)

Sorry, I admit I hadn't known/forgotten that the documented behaviour was to truncate and not round in spite of having documented it myself back in 4c20f3d (Document that wxPoint(wxRealPoint) ctor truncates, not rounds., 2013-04-16). Of course, by now the changes of 1f7a8a8 (Round, rather than truncate, in wxSize and wxPoint operations, 2018-03-06) are in place since almost 8 years, so it's not obvious any more if restoring the original behaviour is better or worse, knowing that it would make 3.4 incompatible with 3.2.

Unless there is some really good reason to prefer truncating (please let me know if there is one), I'd rather change the documentation and keep the behaviour.

The only alternative behaviour I see is to deprecate the current converting ctor wxPoint(const wxRealPoint& pt) and provide 2 static factory functions instead: wxPoint Round(const wxRealPoint& pt) and wxPoint Truncate(const wxRealPoint& pt). And maybe it's worth adding these functions in any case?

Sorry again for changing this in such a cavalier way in the first place...


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26099/3754914704@github.com>

Duncan

unread,
Jan 15, 2026, 9:55:27 AM (18 hours ago) Jan 15
to wx-...@googlegroups.com, Subscribed
duncanspumpkin left a comment (wxWidgets/wxWidgets#26099)

It's fine the project i was working on was finally getting round to updating from 3.0.4 there can't be too many left doing that. I think probably best just change the documentation at this point and add a note to the changelog.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/26099/3755260266@github.com>

Reply all
Reply to author
Forward
0 new messages