Hi
For background: tools::Rectangle currently has magic values for it's bottom and right fields that indicate that
width/height is "empty".
Unfortunately, this leads to two problems
(1) the magic value is -32767, and sometimes that is a valid input value for a rectangle. Which means that rectangles
can suddenly become "empty".
(2) lots of code processes empty rectangles and just calls GetRight()/GetBottom(), which returns the magic -32767 value,
does some calculations on that value, and just continues happily.
All of which means that we pass around bogus data.
To improve this, I propose to do 3 things
(1) split the empty flags into their own bool values.
(2) make more of the tools::Rectangle methods do reasonable things when the empty flag is set.
(3) assert if code access Right or Bottom on an empty rectangle.
There are currently two gerrit changes related to this:
https://gerrit.libreoffice.org/#/c/71853/
Does a first piece, improving the conversion from tools::Rectangle to
basegfx::B2DRectangle/B2IRectangle,
so that empty translates reasonably.
https://gerrit.libreoffice.org/#/c/71745/
Does the actual changes to tools::Rectangle.
I intend to land the first change (once Regina and Thorsten have weighed in), and then land the second change in stages,
peeling off pieces to make bugfixing easier if we have regressions.
Caolán, I anticipate that this work will result in some work from crash-testing which will probably flush out more
places that attempt to do computation on empty rectangles.
Regards, Noel.
Context
- improving empty handling in tools::Rectangle · Noel Grandin
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.