Skip to content

Commit

Permalink
Fix another off by one error introduced by #110
Browse files Browse the repository at this point in the history
  • Loading branch information
tuupola committed Mar 18, 2023
1 parent 81ee12a commit 125804e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/hagl_bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ hline(void *_bitmap, int16_t x0, int16_t y0, uint16_t width, hagl_color_t color)
hagl_bitmap_t *bitmap = _bitmap;

hagl_color_t *ptr = (hagl_color_t *) (bitmap->buffer + bitmap->pitch * y0 + (bitmap->depth / 8) * x0);
for (uint16_t x = 0; x <= width; x++) {
for (uint16_t x = 0; x < width; x++) {
*ptr++ = color;
}
}
Expand All @@ -75,7 +75,7 @@ vline(void *_bitmap, int16_t x0, int16_t y0, uint16_t height, hagl_color_t color
hagl_bitmap_t *bitmap = _bitmap;

hagl_color_t *ptr = (hagl_color_t *) (bitmap->buffer + bitmap->pitch * y0 + (bitmap->depth / 8) * x0);
for (uint16_t y = 0; y <= height; y++) {
for (uint16_t y = 0; y < height; y++) {
*ptr = color;
ptr += bitmap->pitch / (bitmap->depth / 8);
}
Expand Down

0 comments on commit 125804e

Please sign in to comment.