Pixel optim
- Posted by Alexander <Carnivals at INAME.COM> Nov 26, 2000
- 401 views
I have managed to put together a graphics library, however, the routines I'm using are very slow (go figure why :)) Anyway, do anyone know a optimization for this code?: global procedure display_emb_vscreen(atom xoffset, atom yoffset, atom xparent, atom source) atom cache1, cache2, xvar, yvar, color, readpos cache1 = peek(source) cache2 = peek(source+1) xvar = cache1*256+cache2 cache1 = peek(source+2) cache2 = peek(source+3) yvar = cache1*256+cache2 readpos = 4 for y = 1 to yvar do for x = 1 to xvar do color = peek(source+readpos) if color != xparent then vscreen[y+yoffset][x+xoffset] = color end if readpos = readpos + 1 end for end for end procedure xvar and yvar is the size of the picture :) source is the hex address of where it starts BTW: Sorry for stealing the idea of a virtual screen :) but this routine is 20% faster than my old