RFC: Sane rectangle class

Luboš Luňák l.lunak at collabora.com
Mon Mar 23 14:49:06 UTC 2020


On Friday 20 of March 2020, Thorsten Behrens wrote:
> Luboš Luňák wrote:
> > > One question: any reason not to tweak the basegfx classes to fit this
> > > model?
> >
> >  Looking at those classes, I think their API serves some other
> > purpose than "simple point/size/rectangle", so the closest to
> > tweaking them I see is wrapping them in a completely new API.
>
> No, not from what I can tell. Where to you see that other purpose?

 To put it more bluntly, I think the B2IRectangle API is bad. A glaring 
example is the class hierarchy, which is needlessly complicated and confusing 
for the use case of "simply a rectangle" (so a rectangle is actually a range, 
a size is actually a vector, and both point and vector are actually a kind of 
tuple ... huh?). It also causes technical problems, as mistakes such 
as 'B2IRectangle( B2ISize( 0, 0 ), B2IPoint( 0, 0 ))' will compile without 
problems.

 Replacing one error-prone API with another error-prone API doesn't solve 
anything.

-- 
 Luboš Luňák
 l.lunak at collabora.com


More information about the LibreOffice mailing list