From de8d41a0f8d9efeef0337a4ba752b57fc79c4bc3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sun, 22 Mar 2015 10:38:26 +0100 Subject: [PATCH] Use video_driver_set_rotation --- dynamic.c | 7 +------ gfx/video_driver.c | 17 +++++++++++++++-- gfx/video_driver.h | 2 ++ settings.c | 3 +-- 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/dynamic.c b/dynamic.c index 6ff57a7fda..093695eee1 100644 --- a/dynamic.c +++ b/dynamic.c @@ -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; } diff --git a/gfx/video_driver.c b/gfx/video_driver.c index fc47960a31..0dedb39d5c 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -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; +} diff --git a/gfx/video_driver.h b/gfx/video_driver.h index 4bb8861f26..b50743f86b 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -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 diff --git a/settings.c b/settings.c index 9be21b4fd6..1d2566a2b8 100644 --- a/settings.c +++ b/settings.c @@ -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); }