In this code I initially created the phase scope object (which uses SDL_LoadBitmap) after the wave surface, however this caused strange horizontal colour bars at the top of the scope (see uploaded pic). Changing the order fixed it (though I’ve no idea why, the scope doesn’t depend on the wave surface creation).
Also, with the glitch the program ran fine until I exited and SDL_FreeSurface was called, which made it exit with a bad value.
Even though this fixed that particular glitch, now I’ve brought in a fader UI class that I made last year (and has always worked perfectly) - every now and then the same glitch happens with the fader. It’s by no means every time, about 1 in 6 times. This class uses SDL_LoadBitmap too, so I was wondering if I was doing something wrong with calling that. Must I create a surface before loading a BMP into it, or will SDL_LoadBitmap do that for me?
XY_scope = new TXS_phase_scope (scr_scanner, dest_window_surface); // If this is done after wave_surface creation, weird glitch happens.
wave_surface = SDL_CreateRGBSurface
(
SDL_SWSURFACE,
TXS_WAVE_WIDTH,
TXS_WAVE_HEIGHT,
TXS_SCREEN_BPP,
main_window_format->Rmask,
main_window_format->Gmask,
main_window_format->Bmask,
main_window_format->Amask
);