More screenload hacking: a faster replrop
Jef Poskanzer
jef at helios.ee.lbl.gov
Fri Dec 30 12:56:18 AEST 1988
After I added the -t for tiling flag to screenload, I was not happy with
the speed. Just from watching a small bitmap get tiled over the full
screen, it looks like pr_replrop is doing a simple linear replication.
Now, any graphics hacker knows that since edge handling is expensive in
bit blitting, a large blit goes faster than N smaller blits with the same
area. So I whipped up a quick binary replication wrapper routine, and did
some timings. For tiling a small bitmap over the full screen, on a 3/50,
my replrop goes four times faster than Sun's.
The routine is appended. This should be 100% compatible with pr_replrop.
If anyone finds any cases where this isn't so, please let me know. Also,
I would be interested in hearing whether similar speedups are seen on
other configurations, such as color frame buffers.
---
Jef
Jef Poskanzer jef at rtsg.ee.lbl.gov ...well!pokey
jef_pr_replrop(dpr, dx, dy, dw, dh, op, spr, sx, sy)
Pixrect *dpr, *spr;
int dx, dy, dw, dh, op, sx, sy;
{
register int w, h, status;
if ( spr == (Pixrect *) 0 ) {
return pr_replrop(dpr, dx, dy, dw, dh, op, spr, sx, sy);
}
w = spr->pr_size.x;
h = spr->pr_size.y;
if (status = pr_replrop(dpr, dx, dy, w, h, op, spr, sx, sy))
return status;
op &= ~ PIX_DONTCLIP;
while ( w < dw || h < dh ) {
if ( w < dw )
if (status = pr_rop(dpr, dx + w, dy, w, h, op, dpr, dx, dy))
return status;
if ( h < dh )
if (status = pr_rop(dpr, dx, dy + h, w, h, op, dpr, dx, dy))
return status;
if ( w < dw && h < dh )
if (status = pr_rop(dpr, dx + w, dy + h, w, h, op, dpr, dx, dy))
return status;
w *= 2;
h *= 2;
}
}
More information about the Comp.sys.sun
mailing list