RFC: Sane rectangle class

Thorsten Behrens thb at libreoffice.org
Thu Mar 19 20:28:51 UTC 2020

Hey Luboš,

Luboš Luňák wrote:
>  So, yeah, I'm proposing a new standard Rectangle class (and I know
> xkcd, and I'm still serious). My idea is roughly that there will be
> some tools::NewRectangle (or whatever usable name), it will be more
> or less like tools::Rectangle, but it'll make things clear [...]
Please don't put anything into tools anymore. Tools is a delete-only
module, and needs to die.

> for example:
> - internal representation will be whatever sane thing will work, e.g.
>   x,y,width,height , and it won't matter for the API
> - empty rectangle is simply width == 0 || height == 0
> - no (int, int, int, int) ctor
> - we can try without bottom and right functions, or we can define what they
>   mean and be consistent about it (no idea, no preference)
> - there will be things like FromOpenRectangle() to allow converting from/to
>   tools::Rectangle, making it hopefully easier to gradually move over
All sounds sane.

One question: any reason not to tweak the basegfx classes to fit this
model? That would avoid the N-th implementation issue, shouldn't be
too onerous (given the low number of client usages), and answers
Noel's question around underlying value type.


-- Thorsten
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 1032 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20200319/4c5dd883/attachment.sig>

More information about the LibreOffice mailing list