Closed wasamasa closed 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.
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.
Actually, KW_IsRectEmpty can be removed, no one is using it.
Hm, grep
disagrees here and found two hits in KW_label_internal.c
and KW_renderdriver_sdl2.c
.
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
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.
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...