Skip to content

Commit a2becfd

Browse files
authored
Merge pull request #80 from Bennctu/fix_rightbound
Correct right-bound filling
2 parents 501453e + f4137f5 commit a2becfd

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

src/pixmap.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ twin_pixmap_t *twin_pixmap_create(twin_format_t format,
3737
pixmap->height = height;
3838
twin_matrix_identity(&pixmap->transform);
3939
pixmap->clip.left = pixmap->clip.top = 0;
40-
pixmap->clip.right = pixmap->width - 1;
40+
pixmap->clip.right = pixmap->width;
4141
pixmap->clip.bottom = pixmap->height;
4242
pixmap->origin_x = pixmap->origin_y = 0;
4343
pixmap->stride = stride;
@@ -67,7 +67,7 @@ twin_pixmap_t *twin_pixmap_create_const(twin_format_t format,
6767
pixmap->height = height;
6868
twin_matrix_identity(&pixmap->transform);
6969
pixmap->clip.left = pixmap->clip.top = 0;
70-
pixmap->clip.right = pixmap->width - 1;
70+
pixmap->clip.right = pixmap->width;
7171
pixmap->clip.bottom = pixmap->height;
7272
pixmap->origin_x = pixmap->origin_y = 0;
7373
pixmap->stride = stride;
@@ -231,8 +231,8 @@ void twin_pixmap_clip(twin_pixmap_t *pixmap,
231231
pixmap->clip.left = 0;
232232
if (pixmap->clip.top < 0)
233233
pixmap->clip.top = 0;
234-
if (pixmap->clip.right > pixmap->width - 1)
235-
pixmap->clip.right = pixmap->width - 1;
234+
if (pixmap->clip.right > pixmap->width)
235+
pixmap->clip.right = pixmap->width;
236236
if (pixmap->clip.bottom > pixmap->height)
237237
pixmap->clip.bottom = pixmap->height;
238238
}
@@ -269,7 +269,7 @@ void twin_pixmap_reset_clip(twin_pixmap_t *pixmap)
269269
{
270270
pixmap->clip.left = 0;
271271
pixmap->clip.top = 0;
272-
pixmap->clip.right = pixmap->width - 1;
272+
pixmap->clip.right = pixmap->width;
273273
pixmap->clip.bottom = pixmap->height;
274274
}
275275

src/poly.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ static void _span_fill(twin_pixmap_t *pixmap,
213213
}
214214

215215
/* last pixel */
216-
if (right & TWIN_POLY_MASK) {
216+
if (right & TWIN_POLY_MASK && x != right) {
217217
w = 0;
218218
col = 0;
219219
while (x < right) {

0 commit comments

Comments
 (0)