screen: cleanup

This commit is contained in:
cinap_lenrek 2012-07-18 15:08:01 +02:00
parent b9ca8e8378
commit c71c05dd64

View file

@ -176,7 +176,7 @@ flushmemscreen(Rectangle r)
{ {
VGAscr *scr; VGAscr *scr;
uchar *sp, *disp, *sdisp, *edisp; uchar *sp, *disp, *sdisp, *edisp;
int y, len, incs, off, xoff, page; int y, len, incs, off, page;
scr = &vgascreen[0]; scr = &vgascreen[0];
if(scr->gscreen == nil || scr->useflush == 0) if(scr->gscreen == nil || scr->useflush == 0)
@ -188,45 +188,32 @@ flushmemscreen(Rectangle r)
if(rectclip(&r, scr->gscreen->r) == 0) if(rectclip(&r, scr->gscreen->r) == 0)
return; return;
disp = scr->vaddr; disp = scr->vaddr;
incs = scr->gscreen->width * BY2WD; incs = scr->gscreen->width*BY2WD;
xoff = (r.min.x*scr->gscreen->depth) / 8; off = (r.min.x*scr->gscreen->depth) / 8;
off = r.min.y*incs + xoff; len = (r.max.x*scr->gscreen->depth + 7) / 8;
len -= off;
off += r.min.y*incs;
sp = scr->gscreendata->bdata + scr->gscreen->zero + off; sp = scr->gscreendata->bdata + scr->gscreen->zero + off;
/* /*
* Linear framebuffer but with softscreen. * Linear framebuffer with softscreen.
*/ */
if(scr->paddr){ if(scr->paddr){
len = (r.max.x*scr->gscreen->depth + 7) / 8; sdisp = disp+off;
len -= xoff; for(y = r.min.y; y < r.max.y; y++) {
sdisp = disp + off;
edisp = sdisp + Dy(r)*incs;
while(sdisp < edisp){
memmove(sdisp, sp, len); memmove(sdisp, sp, len);
sdisp += incs;
sp += incs; sp += incs;
sdisp += incs;
} }
return; return;
} }
/* /*
* Paged access thru 64K window. * Paged framebuffer window.
* It would be fair to say that this doesn't work for >8-bit screens.
*/ */
if(scr->dev == nil || scr->dev->page == nil) if(scr->dev == nil || scr->dev->page == nil)
return; return;
switch(scr->gscreen->depth){
default:
len = 0;
break;
case 8:
len = Dx(r);
break;
}
if(len < 1)
return;
page = off/scr->apsize; page = off/scr->apsize;
off %= scr->apsize; off %= scr->apsize;
sdisp = disp+off; sdisp = disp+off;