Skip to content

Commit de008d0

Browse files
committed
实现画面外的支持
1 parent 6231343 commit de008d0

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

11_day/sheet.c

+7
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,13 @@ void sheet_refreshsub(struct SHTCTL *ctl, int vx0, int vy0, int vx1, int vy1)
113113
int h, bx, by, vx, vy, bx0, by0, bx1, by1;
114114
unsigned char *buf, c, *vram = ctl->vram;
115115
struct SHEET *sht;
116+
117+
/* 如果refresh的范围超出了画面则修正 */
118+
if (vx0 < 0) { vx0 = 0; }
119+
if (vy0 < 0) { vy0 = 0; }
120+
if (vx1 > ctl->xsize) { vx1 = ctl->xsize; }
121+
if (vy1 > ctl->ysize) { vy1 = ctl->ysize; }
122+
116123
for (h = 0; h <= ctl->top; h++) {
117124
sht = ctl->sheets[h];
118125
buf = sht->buf;

0 commit comments

Comments
 (0)