Use video_driver_set_rotation

This commit is contained in:
twinaphex 2015-03-22 10:38:26 +01:00
parent 42cf31ef2c
commit de8d41a0f8
4 changed files with 19 additions and 10 deletions

View File

@ -700,12 +700,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
global->system.rotation = rotation;
if (driver->video && driver->video->set_rotation)
{
if (driver->video_data)
driver->video->set_rotation(driver->video_data, rotation);
}
else
if (!video_driver_set_rotation(rotation))
return false;
break;
}

View File

@ -543,8 +543,7 @@ void init_video(void)
driver->video->viewport_info(driver->video_data, custom_vp);
}
if (driver->video->set_rotation)
driver->video->set_rotation(driver->video_data,
video_driver_set_rotation(
(settings->video.rotation + global->system.rotation) % 4);
if (driver->video->suppress_screensaver)
@ -595,3 +594,17 @@ void video_driver_set_nonblock_state(bool toggle)
if (driver->video->set_nonblock_state)
driver->video->set_nonblock_state(driver->video_data, toggle);
}
bool video_driver_set_rotation(unsigned rotation)
{
driver_t *driver = driver_get_ptr();
if (!driver->video)
return false;
if (!driver->video->set_rotation)
return false;
driver->video->set_rotation(driver->video_data, rotation);
return true;
}

View File

@ -276,6 +276,8 @@ bool video_driver_has_windowed(void);
void video_driver_set_nonblock_state(bool toggle);
bool video_driver_set_rotation(unsigned rotation);
#ifdef __cplusplus
}
#endif

View File

@ -3051,8 +3051,7 @@ static void general_write_handler(void *data)
}
else if (!strcmp(setting->name, "video_rotation"))
{
if (driver->video && driver->video->set_rotation)
driver->video->set_rotation(driver->video_data,
video_driver_set_rotation(
(*setting->value.unsigned_integer +
global->system.rotation) % 4);
}