mobius3 / kiwi

KiWi: Killer Widgets
zlib License
186 stars 19 forks source link

KW_IsRectEmpty definition #20

Closed wasamasa closed 8 years ago

wasamasa commented 8 years ago

Why do the x and y coordinates play a role in whether a KW_Rect is empty? And why must both the width and height be zero? Assuming a rectangle got a width of zero, but a non-zero height, the area it spans would still be zero, yet it wouldn't be considered empty...

mobius3 commented 8 years ago

Yeah, I agree it should be reviewed. I guess we need KW_GetRectArea() in this case, it is generally being used for that reason. What is an empty rect needs more debate, maybe KW_IsRectEmpty should be rename to KW_IsRectZeroed or something.

wasamasa commented 8 years ago

The reason I'm bringing this up is twofold, once it's because I'm pretty sure that the x and y coordinates aren't involved, the other is because the requirement of both the width and height being zero reminds me of the scrollbox scrollbar bug.

mobius3 commented 8 years ago

Actually, KW_IsRectEmpty can be removed, no one is using it.

wasamasa commented 8 years ago

Hm, grep disagrees here and found two hits in KW_label_internal.c and KW_renderdriver_sdl2.c.

mobius3 commented 8 years ago

My grep-fu failed me then. [EDIT] I grepped IsRectEmtpy, lol. Anyways, both of them are internal/private files, I'd rather use that check directly and eliminate KW_IsRectEmpty

mobius3 commented 8 years ago

Fixed in f40b56f I removed the macro entirely. Turns out the x/y check was needed in the sdl2 renderdriver. A completely empty rectangle would mean to disable SDL clipping. Obviously even this assumption is wrong. I've also fixed that, now you need to explicitly pass a NULL KW_Rect pointer to KWSDL_setClipRect.