/* listing 4: Example of how to generate mip-maps Generates a half size version of a monochrome 8 bit image in "src", of dimensions src_width, src_height with pitch src_pitch. outputs to image dst with pitch dst_pitch */ void GenerateOneMipMap(UBYTE *src, int src_width, int src_height, int src_pitch, UBYTE *dst, int dst_pitch) { int w=src_width>>1; // compute size of output mipmap int h=src_height>>1; dst_pitch-=w; // adjust pitches to account for loops int src_pitch2=src_pitch*2-w*2; for (int y=0;y>2; src+=2; } dst+=dst_pitch; src+=src_pitch2; } }