Unreachable code in lv_draw_rect.c:lv_draw_shadow_bottom()

In lv_draw_shadow_bottom(), just under
/If radius == 0 is a special case/
if(style->body.radius == 0) {

there is a block ending in return.

Further below, by the end of the function, there is another conditional/block, starting with
/If radius == 0 one px on the corners are not drawn by main drawer/
if(style->body.radius == 0) {

Am I missing something, or is the latter unreachable code?

If it is, removing it reduced my Cortex-M4 code by some 250 bytes (gcc, maybe better compilers can eliminate this automagically).

JW

Hi,

Thank you for pointing this out.
v7.0 will be released soon where shadow drawing is completely rewritten. If you don’t mind I wouldn’t bother with this for this short time.

Hello Kisve,

I understand your position.

Nevertheless, this one appears to be quite a clear issue and a risk-free improvement; and there may be others like myself who still stick to v6.x for whatever reason and would benefit from this change. So I’d like to ask you to spend a few more moments checking this one - if it’s not THAT clear than I thought, well then just leave it as it is now, this post might be enough for tinkerers out there to do it themselves.

Thanks,

Jan

That’s true. I’ve just removed those lines. Please open an issue on GitHub if it’s not working as expected.

Thanks,

Jan