drect_border unexpected behavior #14

Closed
opened 2021-04-30 01:38:48 +02:00 by kdx · 2 comments

Hello, I wanted to use the drect_border function today and wasn't expecting it to "clip" borders to the screen boundaries. I wanted to use it for a moving box that goes out of bound, the current behavior prevent this kind of usage.

Here is a minimal code demonstrating what I mean:

#include <gint/display.h>
#include <gint/keyboard.h>

int
main(void)
{
        dclear(C_WHITE);
        drect_border(-666, -7, 42, 1337, C_WHITE, 8, C_BLACK);
        dupdate();

        getkey();
        return 1;
}

Behavior expected:

....*.........
....*.........
....*.........
....*.........
....*.........

What gint draws:

*****.........
*...*.........
*...*.........
*...*.........
*****.........

Thank you for your attention.

Hello, I wanted to use the `drect_border` function today and wasn't expecting it to "clip" borders to the screen boundaries. I wanted to use it for a moving box that goes out of bound, the current behavior prevent this kind of usage. Here is a minimal code demonstrating what I mean: ```c #include <gint/display.h> #include <gint/keyboard.h> int main(void) { dclear(C_WHITE); drect_border(-666, -7, 42, 1337, C_WHITE, 8, C_BLACK); dupdate(); getkey(); return 1; } ``` Behavior expected: ```text ....*......... ....*......... ....*......... ....*......... ....*......... ``` What gint draws: ```text *****......... *...*......... *...*......... *...*......... *****......... ``` Thank you for your attention.
Owner

You are correct, this is a bug. The expected behavior is that clipping does not move the border. Since drect() does all the needed checks anyway, I dropped the bound-checking code to keep only the simple cases.

You can check this out on dev, if everything works correctly for you this will be in the next release (which shouldn't take too long since the USB driver is coming).

You are correct, this is a bug. The expected behavior is that clipping does not move the border. Since `drect()` does all the needed checks anyway, I dropped the bound-checking code to keep only the simple cases. You can check this out on `dev`, if everything works correctly for you this will be in the next release (which shouldn't take too long since the USB driver is coming).
Author

It all works as expected on dev, thank you!

It all works as expected on `dev`, thank you!
kdx closed this issue 2021-04-30 10:23:47 +02:00
Sign in to join this conversation.
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: Lephenixnoir/gint#14
No description provided.