Path: utzoo!utgpu!attcan!uunet!lll-winken!lll-lcc!ames!mailrus!cornell!uw-beaver!rice!sun-spots-request From: jef@helios.ee.lbl.gov (Jef Poskanzer) Newsgroups: comp.sys.sun Subject: More screenload hacking: a faster replrop Message-ID: <8812180448.AA04796@helios.ee.lbl.gov> Date: 30 Dec 88 02:56:18 GMT Sender: usenet@rice.edu Organization: Sun-Spots Lines: 49 Approved: Sun-Spots@rice.edu Original-Date: Sat, 17 Dec 88 20:48:55 PST X-Sun-Spots-Digest: Volume 7, Issue 78, message 8 of 10 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@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; } }