From de008d0ec5e4c7d0dc691c5b10cc725df14bd516 Mon Sep 17 00:00:00 2001 From: Yourtion Date: Fri, 15 Apr 2016 10:43:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E7=8E=B0=E7=94=BB=E9=9D=A2=E5=A4=96?= =?UTF-8?q?=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 11_day/sheet.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/11_day/sheet.c b/11_day/sheet.c index e5bd624..2df8d99 100644 --- a/11_day/sheet.c +++ b/11_day/sheet.c @@ -113,6 +113,13 @@ void sheet_refreshsub(struct SHTCTL *ctl, int vx0, int vy0, int vx1, int vy1) int h, bx, by, vx, vy, bx0, by0, bx1, by1; unsigned char *buf, c, *vram = ctl->vram; struct SHEET *sht; + + /* 如果refresh的范围超出了画面则修正 */ + if (vx0 < 0) { vx0 = 0; } + if (vy0 < 0) { vy0 = 0; } + if (vx1 > ctl->xsize) { vx1 = ctl->xsize; } + if (vy1 > ctl->ysize) { vy1 = ctl->ysize; } + for (h = 0; h <= ctl->top; h++) { sht = ctl->sheets[h]; buf = sht->buf;