Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!unmvax!ncar!ames!husc6!rice!sun-spots-request From: jef@helios.ee.lbl.gov (Jef Poskanzer) Newsgroups: comp.sys.sun Subject: Addendum to "faster replrop" message Message-ID: <8812181938.AA07124@helios.ee.lbl.gov> Date: 5 Jan 89 07:54:26 GMT Sender: usenet@rice.edu Organization: Faculteit Wiskunde & Informatica, Universiteit van Amsterdam Lines: 47 Approved: Sun-Spots@rice.edu Original-Date: Sun, 18 Dec 88 11:38:09 PST X-Sun-Spots-Digest: Volume 7, Issue 89, message 11 of 11 I did some more timings, and came up with the appended version. It is a few percent faster than the one in my original message. If you Jfeel like it, replace that one with this one when you post the message. Jef 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 ) { /* Special case the NULL pixrect. */ w = dw; h = dh; } else { w = spr->pr_size.x; /* Avoid tiny horizontal blits. */ while ( w < 256 ) w *= 2; if ( w > dw ) w = dw; h = spr->pr_size.y; /* But no edge effects vertically, so no problem. */ if ( h > dh ) h = dh; } 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; } return 0; }