I'm trying to optimize memory access to an SDL_Surface in the lispbuilder-sdl project. An SDL_Surface is basically a foreign array. Reading and writing individual pixels involves calling MEM-AREF to access an integer value at a specific offset in the SDL_Surface array. This is fine for individual pixel reads and writes but sub-optimal for a rotation function where there is a read and corresponding write for each pixel in the surface (For example a 320x240 resolution surface requires a total of 153,600 calls to MEM-AREF in order to perform a rotation.)
Can I use WITH-POINTER-TO-VECTOR-DATA to somehow speed this up?
Thanks, - Luke