2020-04-30 08:42 AM
I've come up with the following issue while trying to invalidate an area. I would expect that I could grab a MinimalRect from an object and pass it directly to the base container, as the following:
invalidateRect(arc.getMinimalRect());
However, I get the following compiler error:
error: cannot bind non-const lvalue reference of type 'touchgfx::Rect&' to an rvalue of type 'touchgfx::Rect' invalidateRect(arc.getMinimalRect());
If the invalidateRect function signature is changed to:
void Drawable::invalidateRect(Rect const & rect);
It will compile, but then it will obviously not link, since the Drawable source isn't available. According to the documentation, "rect" is just an input, not an output. Wouldn't it make sense to have it passed by const reference?
Thanks,
Jeremy
2020-04-30 11:04 AM
It would make sense to pass as a const ref. Until that happens:
Rect r = circle.getMinimalRect();
invalidateRect(r);
/Martin