Add RARCH_DISPLAY_CTL_CACHED_FRAME_HAS_VALID_FB

This commit is contained in:
twinaphex 2015-11-20 15:38:10 +01:00
parent 6286e4b74c
commit d8eeed0a9e
3 changed files with 6 additions and 9 deletions

View File

@ -791,12 +791,6 @@ void video_driver_get_video_output_prev(void)
}
bool video_driver_cached_frame_has_valid_fb(void)
{
if (!video_state.frame_cache.data)
return false;
return (video_state.frame_cache.data == RETRO_HW_FRAME_BUFFER_VALID);
}
void video_driver_cached_frame_set_ptr(const void *data)
{
@ -1187,6 +1181,10 @@ bool video_driver_ctl(enum rarch_display_ctl_state state, void *data)
switch (state)
{
case RARCH_DISPLAY_CTL_CACHED_FRAME_HAS_VALID_FB:
if (!video_state.frame_cache.data)
return false;
return (video_state.frame_cache.data == RETRO_HW_FRAME_BUFFER_VALID);
case RARCH_DISPLAY_CTL_CACHED_FRAME_RENDER:
return video_driver_cached_frame();
case RARCH_DISPLAY_CTL_IS_FOCUSED:

View File

@ -227,6 +227,7 @@ enum rarch_display_ctl_state
RARCH_DISPLAY_CTL_IS_FOCUSED,
/* Renders the current video frame. */
RARCH_DISPLAY_CTL_CACHED_FRAME_RENDER,
RARCH_DISPLAY_CTL_CACHED_FRAME_HAS_VALID_FB,
RARCH_DISPLAY_CTL_GET_FRAME_COUNT
};
@ -378,8 +379,6 @@ void video_driver_cached_frame_set_ptr(const void *data);
void video_driver_cached_frame_get(const void **data, unsigned *width,
unsigned *height, size_t *pitch);
bool video_driver_cached_frame_has_valid_fb(void);
#ifdef __cplusplus
}
#endif

View File

@ -234,7 +234,7 @@ bool take_screenshot(void)
if (viewport_read)
ret = take_screenshot_viewport();
else if (!video_driver_cached_frame_has_valid_fb())
else if (!video_driver_ctl(RARCH_DISPLAY_CTL_CACHED_FRAME_HAS_VALID_FB, NULL))
ret = take_screenshot_raw();
else if (driver->video->read_frame_raw)
{