Skip to content

Commit

Permalink
Fix the right bound filling incorrectly
Browse files Browse the repository at this point in the history
Because the right side of graph is cutoff, we add 1 to the width
computation (via left and right index) to ensure proper bound of the
graph.

Close #78
  • Loading branch information
Bennctu committed Dec 8, 2024
1 parent a90b142 commit 91bbeff
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions apps/multi.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static void apps_circletext_start(twin_screen_t *screen,
{
twin_window_t *window = twin_window_create(
screen, TWIN_ARGB32, TwinWindowApplication, x, y, w, h);
int wid = window->client.right - window->client.left;
int wid = window->client.right - window->client.left + 1;
int hei = window->client.bottom - window->client.top;
twin_pixmap_t *pixmap = window->pixmap;
twin_path_t *path = twin_path_create();
Expand Down Expand Up @@ -84,7 +84,7 @@ static void apps_quickbrown_start(twin_screen_t *screen,
{
twin_window_t *window = twin_window_create(
screen, TWIN_ARGB32, TwinWindowApplication, x, y, w, h);
int wid = window->client.right - window->client.left;
int wid = window->client.right - window->client.left + 1;
int hei = window->client.bottom - window->client.top;
twin_pixmap_t *pixmap = window->pixmap;
twin_path_t *path = twin_path_create();
Expand Down Expand Up @@ -127,7 +127,7 @@ static void apps_ascii_start(twin_screen_t *screen, int x, int y, int w, int h)
{
twin_window_t *window = twin_window_create(
screen, TWIN_ARGB32, TwinWindowApplication, x, y, w, h);
int wid = window->client.right - window->client.left;
int wid = window->client.right - window->client.left + 1;
int hei = window->client.bottom - window->client.top;
twin_pixmap_t *pixmap = window->pixmap;
twin_path_t *path = twin_path_create();
Expand Down
2 changes: 1 addition & 1 deletion src/path.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,7 +612,7 @@ void twin_composite_path(twin_pixmap_t *dst,
if (bounds.left >= bounds.right || bounds.top >= bounds.bottom)
return;

twin_coord_t width = bounds.right - bounds.left;
twin_coord_t width = bounds.right - bounds.left + 1;
twin_coord_t height = bounds.bottom - bounds.top;
twin_pixmap_t *mask = twin_pixmap_create(TWIN_A8, width, height);
if (!mask)
Expand Down

0 comments on commit 91bbeff

Please sign in to comment.