cancel
Showing results for 
Search instead for 
Did you mean: 

Does Drawable::invalidateRect need a non-const rect?

j o
Associate II

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

1 REPLY 1
Martin KJELDSEN
Chief III

It would make sense to pass as a const ref. Until that happens:

Rect r = circle.getMinimalRect();
invalidateRect(r);    

/Martin