// Buffer is R G B for each pixel, then across then down. If you want X, Y,
// it's: 3 * (x + y * width)
for(y=bufbounds.y1;y<bufbounds.y2;y++){
texx=texbounds.x1;
for(x=bufbounds.x1;x<bufbounds.x2;x++){
// And then with the shift, it is log2(256), or whatever you shifted
// by up there. So 512 would be 9, because 2^9 = 512
texi=(texx>>unigi_ext_texture_fixedpointdepth)+tex.width*(texy>>unigi_ext_texture_fixedpointdepth);// 'texy >> FIXEDPOINTDEPTH' could be calculated per y-iteration
bufi=x+y*buffer.width;// 'y * buffer.width' could be calculated per y-iteration