src/bbcvdu.c
// Bugfix version of SDL_RenderReadPixels (SDL Bugzilla 2740)
// Also much faster on some platforms because reading pixels from the
// default render target is faster than reading from a target texture.
// n.b. This bugfix routine cannot read a bigger rect than the window!
Bugfix version of SDL_RenderReadPixels (SDL Bugzilla 2740)
Also much faster on some platforms because reading pixels from the
default render target is faster than reading from a target texture.
Bugfix version of SDL_RenderReadPixels ( SDL Bugzilla 2740 ) Also much faster on some platforms because reading pixels from the default render target is faster than reading from a target texture .
int BBC_RenderReadPixels (SDL_Renderer* renderer, const SDL_Rect* rect,
                          Uint32 format, void* pixels, int pitch)
{
	int result ;
	SDL_Rect dst = {0, 0, rect->w, rect->h} ;
	SDL_Texture *tex = SDL_GetRenderTarget (renderer) ;
	SDL_SetRenderTarget (renderer, NULL) ;
	SDL_RenderCopy (renderer, tex, rect, &dst) ;
	result = SDL_RenderReadPixels (renderer, &dst, format, pixels, pitch) ;
	SDL_SetRenderTarget (renderer, tex) ;
	return result ;
}
int BBC_RenderReadPixels ( SDL_Renderer * renderer , const SDL_Rect * rect , Uint32 format , void * pixels , int pitch ) { int result ; SDL_Rect dst = { 0 , 0 , rect -> w , rect -> h } ; SDL_Texture * tex = SDL_GetRenderTarget ( renderer ) ; SDL_SetRenderTarget ( renderer , NULL ) ; SDL_RenderCopy ( renderer , tex , rect , & dst ) ; result = SDL_RenderReadPixels ( renderer , & dst , format , pixels , pitch ) ; SDL_SetRenderTarget ( renderer , tex ) ; return result ; }
Bugfix version of SDL_RenderReadPixels (SDL Bugzilla 2740)
Also much faster on some platforms because reading pixels from the
default render target is faster than reading from a target texture.
Bugfix version of SDL_RenderReadPixels ( SDL Bugzilla 2740 ) Also much faster on some platforms because reading pixels from the default render target is faster than reading from a target texture .