forked from backup/30dayMakeOS
提高叠加处理速度(1)
This commit is contained in:
@@ -77,7 +77,7 @@ void sheet_updown(struct SHTCTL *ctl, struct SHEET *sht, int height)
|
||||
}
|
||||
ctl->top--; /* 由于显示中的图层减少了一个,所以最上面的图层高度下降 */
|
||||
}
|
||||
sheet_refresh(ctl); /* 按新图层的信息重新绘制画面 */
|
||||
sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize); /* 按新图层的信息重新绘制画面 */
|
||||
} else if (old < height) { /* 比以前高 */
|
||||
if (old >= 0) {
|
||||
/* 把中间的拉下去 */
|
||||
@@ -95,12 +95,20 @@ void sheet_updown(struct SHTCTL *ctl, struct SHEET *sht, int height)
|
||||
ctl->sheets[height] = sht;
|
||||
ctl->top++; /* 由于已显示的图层增加了1个,所以最上面的图层高度增加 */
|
||||
}
|
||||
sheet_refresh(ctl); /* 按新图层信息重新绘制画面 */
|
||||
sheet_refreshsub(ctl, sht->vx0, sht->vy0, sht->vx0 + sht->bxsize, sht->vy0 + sht->bysize); /* 按新图层信息重新绘制画面 */
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void sheet_refresh(struct SHTCTL *ctl)
|
||||
void sheet_refresh(struct SHTCTL *ctl, struct SHEET *sht, int bx0, int by0, int bx1, int by1)
|
||||
{
|
||||
if (sht->height >= 0) { /* 如果正在显示,则按新图层的信息刷新画面*/
|
||||
sheet_refreshsub(ctl, sht->vx0 + bx0, sht->vy0 + by0, sht->vx0 + bx1, sht->vy0 + by1);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
void sheet_refreshsub(struct SHTCTL *ctl, int vx0, int vy0, int vx1, int vy1)
|
||||
{
|
||||
int h, bx, by, vx, vy;
|
||||
unsigned char *buf, c, *vram = ctl->vram;
|
||||
@@ -112,9 +120,11 @@ void sheet_refresh(struct SHTCTL *ctl)
|
||||
vy = sht->vy0 + by;
|
||||
for (bx = 0; bx < sht->bxsize; bx++) {
|
||||
vx = sht->vx0 + bx;
|
||||
c = buf[by * sht->bxsize + bx];
|
||||
if (c != sht->col_inv) {
|
||||
vram[vy * ctl->xsize + vx] = c;
|
||||
if (vx0 <= vx && vx < vx1 && vy0 <= vy && vy < vy1) {
|
||||
c = buf[by * sht->bxsize + bx];
|
||||
if (c != sht->col_inv) {
|
||||
vram[vy * ctl->xsize + vx] = c;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -124,10 +134,12 @@ void sheet_refresh(struct SHTCTL *ctl)
|
||||
|
||||
void sheet_slide(struct SHTCTL *ctl, struct SHEET *sht, int vx0, int vy0)
|
||||
{
|
||||
int old_vx0 = sht->vx0, old_vy0 = sht->vy0;
|
||||
sht->vx0 = vx0;
|
||||
sht->vy0 = vy0;
|
||||
if (sht->height >= 0) { /* 如果正在显示*/
|
||||
sheet_refresh(ctl); /* 按新图层的信息刷新画面 */
|
||||
if (sht->height >= 0) { /* 如果正在显示,则按新图层的信息刷新画面 */
|
||||
sheet_refreshsub(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize);
|
||||
sheet_refreshsub(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user