src/bbcvdu.c
// Flood fill WHILE colour = specified target
Flood fill WHILE colour = specified target
Flood fill WHILE colour = specified target
static void flooda (char col, char tar, int cx, int cy, int vl, int vr, int vt, int vb)
{
	unsigned int *p ;
	SDL_Texture *tex ;
	SDL_Rect rect = {vl, vt, vr - vl, vb - vt} ;
	if ((rect.w <= 0) || (rect.h <= 0) ||
	    (cx < vl) || (cx >= vr) || (cy < vt) || (cy >= vb))
		return ;
	p = (unsigned int*) malloc (rect.w * rect.h * 4) ;
	BBC_RenderReadPixels (memhdc, &rect, SDL_PIXELFORMAT_ABGR8888, p, rect.w * 4) ;
	flood(p, cx-rect.x, cy-rect.y, rect.w, rect.h, palette[(int)col], palette[(int)tar], 0) ;
	tex = SDL_CreateTexture (memhdc, SDL_PIXELFORMAT_ABGR8888, SDL_TEXTUREACCESS_STREAMING, 
				rect.w, rect.h) ;
	SDL_UpdateTexture (tex, NULL, p, rect.w * 4) ;
	free (p) ;
	SDL_RenderCopy (memhdc, tex, NULL, &rect) ;
	SDL_DestroyTexture (tex) ;
}
static void flooda ( char col , char tar , int cx , int cy , int vl , int vr , int vt , int vb ) { unsigned int * p ; SDL_Texture * tex ; SDL_Rect rect = { vl , vt , vr - vl , vb - vt } ; if ( ( rect . w <= 0 ) || ( rect . h <= 0 ) || ( cx < vl ) || ( cx >= vr ) || ( cy < vt ) || ( cy >= vb ) ) return ; p = ( unsigned int * ) malloc ( rect . w * rect . h * 4 ) ; BBC_RenderReadPixels ( memhdc , & rect , SDL_PIXELFORMAT_ABGR8888 , p , rect . w * 4 ) ; flood ( p , cx - rect . x , cy - rect . y , rect . w , rect . h , palette [ ( int ) col ] , palette [ ( int ) tar ] , 0 ) ; tex = SDL_CreateTexture ( memhdc , SDL_PIXELFORMAT_ABGR8888 , SDL_TEXTUREACCESS_STREAMING , rect . w , rect . h ) ; SDL_UpdateTexture ( tex , NULL , p , rect . w * 4 ) ; free ( p ) ; SDL_RenderCopy ( memhdc , tex , NULL , & rect ) ; SDL_DestroyTexture ( tex ) ; }
Flood fill WHILE colour = specified target
Flood fill WHILE colour = specified target