Path: utzoo!utgpu!watserv1!watmath!att!cbnewsm!nsw From: nsw@cbnewsm.ATT.COM (Neil Weinstock) Newsgroups: comp.sys.amiga.tech Subject: Re: How do you draw to the screen quickly? (The real solution) Summary: ?YlsUoIreS SiHt ekAt Message-ID: <9231@cbnewsm.ATT.COM> Date: 13 Feb 90 03:24:09 GMT References: <1092@mindlink.UUCP> Reply-To: nsw@cbnewsm.ATT.COM (Neil Weinstock) Distribution: na Organization: The Flying Squid Patrol Lines: 20 In article <1092@mindlink.UUCP> a464@mindlink.UUCP (Bruce Dawson) writes: > > One way of speeding this up is to write your own WritePixel() routine. [ ... ] Geez, you guys are all missing the obvious and correct solution. The answer, as it almost always is, is to use a lookup table. Use the data for each scan line as the lookup index (simply concatenate the pixel values into one long binary value), and put the corresponding Image structure into that table entry. So, you just take the data, look up the appropriate scan line, and use DrawImage(). Only one operation per scan line. How much quicker can you get? Extending this method to the entire screen is left as an exercise for the reader. ________________ __________________ _________________________ //// \\// \\// \\\\ \\\\ Neil Weinstock //\\ att!cord!nsw or //\\ "Your hair is so... //// //// AT&T Bell Labs \\// nsw@cord.att.com \\// lustre-laden." - Moss \\\\ \\\\________________//\\__________________//\\_________________________////