Create video_driver_cached_frame_set

This commit is contained in:
twinaphex 2015-05-20 21:13:25 +02:00
parent cf2c0f6930
commit ac8d58b7bb
4 changed files with 21 additions and 12 deletions

View File

@ -617,10 +617,7 @@ void init_video(void)
event_command(EVENT_CMD_OVERLAY_DEINIT);
event_command(EVENT_CMD_OVERLAY_INIT);
global->frame_cache.width = 4;
global->frame_cache.height = 4;
global->frame_cache.pitch = 8;
global->frame_cache.data = &dummy_pixels;
video_driver_cached_frame_set(&dummy_pixels, 4, 4, 8);
#if defined(PSP)
video_driver_set_texture_frame(&dummy_pixels, false, 1, 1, 1.0f);
@ -898,6 +895,20 @@ void video_driver_cached_frame(void)
driver->recording_data = recording;
}
void video_driver_cached_frame_set(const void *data, unsigned width,
unsigned height, size_t pitch)
{
global_t *global = global_get_ptr();
if (!global)
return;
global->frame_cache.data = data;
global->frame_cache.width = width;
global->frame_cache.height = height;
global->frame_cache.pitch = pitch;
}
void video_driver_get_size(unsigned *width, unsigned *height)
{
if (width)

View File

@ -381,6 +381,9 @@ void video_driver_set_pixel_format(enum retro_pixel_format fmt);
**/
void video_driver_cached_frame(void);
void video_driver_cached_frame_set(const void *data, unsigned width,
unsigned height, size_t pitch);
#ifdef __cplusplus
}
#endif

View File

@ -94,10 +94,7 @@ static void video_frame(const void *data, unsigned width,
if (!driver->video_active)
return;
global->frame_cache.data = data;
global->frame_cache.width = width;
global->frame_cache.height = height;
global->frame_cache.pitch = pitch;
video_driver_cached_frame_set(data, width, height, pitch);
if (video_frame_scale(data, width, height, pitch))
{

View File

@ -307,10 +307,8 @@ bool take_screenshot(void)
else
ret = false;
global->frame_cache.data = old_data;
global->frame_cache.width = old_width;
global->frame_cache.height = old_height;
global->frame_cache.pitch = old_pitch;
video_driver_cached_frame_set(old_data,
old_width, old_height, old_pitch);
}
else
{