cancel
Showing results for 
Search instead for 
Did you mean: 

"const Rect & Drawable::getRect ()" prohibits use as a parameter in e.g. "Screen::invalidateRect ()"

ferro
Senior III

Hi Gfx Team,

Could Drawable::getRect () in Drawable.hpp

 

const Rect & getRect() const
{
    return rect;
}

 

be changed to

 

Rect getRect() const
{
    return rect;
}

 

 

so it can be used as a parameter in e.g.

 

void Screen::invalidateRect ( Rect & invalidatedArea ) const
{
    container.invalidateRect ( invalidatedArea );
}

 

 

With the current implementation one has to write

 

Screen::invalidateRect ( Rect { Drawable::getRect () } );

 

 

If not, could you add a variation e.g.

 

Rect getRectValue() const
{
    return rect;
}

 

Thanks

Ferro

 

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @ferro ,

Thank you for the good suggestion. I think it would be easier if you use Drawable.invalidateRect() to avoid dealing with coordination conversion (for instance, from local to global).
But, anyway, you can easily copy Drawable.hpp to your project and apply changes to it. For example, you can overload the invalidateRect() like this:

void invalidateRect (const Rect& invalidatedArea) const 
{
     Rect r = invalidatedArea;
     invalidateRect(r);
}

 

You can read more about apply changes to widgets here 

 

I hope this helps you,
Best regards

Mohammad MORADI
ST Software Developer | TouchGFX

View solution in original post

1 REPLY 1

Hello @ferro ,

Thank you for the good suggestion. I think it would be easier if you use Drawable.invalidateRect() to avoid dealing with coordination conversion (for instance, from local to global).
But, anyway, you can easily copy Drawable.hpp to your project and apply changes to it. For example, you can overload the invalidateRect() like this:

void invalidateRect (const Rect& invalidatedArea) const 
{
     Rect r = invalidatedArea;
     invalidateRect(r);
}

 

You can read more about apply changes to widgets here 

 

I hope this helps you,
Best regards

Mohammad MORADI
ST Software Developer | TouchGFX