#include <errno.h>
#define LOAD_FUNC(NAME) \
-_this->tizen_pre_rotation_data.NAME = SDL_LoadFunction(_this->tizen_pre_rotation_data.prerotation_dll_handle, #NAME); \
-if (!_this->tizen_pre_rotation_data.NAME) \
+_this->tizen_rotation_data.NAME = SDL_LoadFunction(_this->tizen_rotation_data.dll_handle, #NAME); \
+if (!_this->tizen_rotation_data.NAME) \
{ \
SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "Could not retrieve pre-rotation function " #NAME); \
return SDL_FALSE; \
}
int
-_tizen_PreRotatotion_LoadLibrary(SDL_VideoData *_this, const char *lib_path)
+_tizen_Rotatotion_LoadLibrary(SDL_VideoData *_this, const char *lib_path)
{
void *lib_dll_handle = NULL;
char *path = NULL;
- if (_this->tizen_pre_rotation_data.prerotation_dll_handle
- && _this->tizen_pre_rotation_data.wl_egl_window_set_rotation
- && _this->tizen_pre_rotation_data.wl_egl_window_get_capabilities)
+ if (_this->tizen_rotation_data.dll_handle
+ && _this->tizen_rotation_data.wl_egl_window_set_rotation
+ && _this->tizen_rotation_data.wl_egl_window_get_capabilities
+ && _this->tizen_rotation_data.wl_egl_window_set_buffer_transform
+ && _this->tizen_rotation_data.wl_egl_window_set_window_transform)
return SDL_TRUE;
- _this->tizen_pre_rotation_data.prerotation_dll_handle = NULL;
- _this->tizen_pre_rotation_data.wl_egl_window_set_rotation = NULL;
- _this->tizen_pre_rotation_data.wl_egl_window_get_capabilities = NULL;
+ _this->tizen_rotation_data.dll_handle = NULL;
+ _this->tizen_rotation_data.wl_egl_window_set_rotation = NULL;
+ _this->tizen_rotation_data.wl_egl_window_get_capabilities = NULL;
+
+ _this->tizen_rotation_data.wl_egl_window_set_buffer_transform = NULL;
+ _this->tizen_rotation_data.wl_egl_window_set_window_transform = NULL;
if (!lib_path)
lib_dll_handle = SDL_LoadObject(lib_path);
lib_dll_handle = SDL_LoadObject(path);
}
- _this->tizen_pre_rotation_data.prerotation_dll_handle = lib_dll_handle;
+ _this->tizen_rotation_data.dll_handle = lib_dll_handle;
if (lib_dll_handle == NULL)
return SDL_FALSE;
LOAD_FUNC(wl_egl_window_set_rotation);
LOAD_FUNC(wl_egl_window_get_capabilities);
+ LOAD_FUNC(wl_egl_window_set_buffer_transform);
+ LOAD_FUNC(wl_egl_window_set_window_transform);
+
return SDL_TRUE;
}
}
void
-Tizen_pre_rotation_set(SDL_WindowData *wind, int rotation)
-{
- tizen_wl_egl_window_rotation rot;
- if (!wind->egl_window) return;
-
- switch (rotation) {
- case 90:
- rot = TIZEN_ROTATION_270;
- break;
- case 180:
- rot = TIZEN_ROTATION_180;
- break;
- case 270:
- rot = TIZEN_ROTATION_90;
- break;
- case 0:
- rot = TIZEN_ROTATION_0;
- break;
- default:
- rot = TIZEN_ROTATION_0;
- break;
- }
-
- SDL_VideoData* _this = SDL_GetVideoDevice()->driverdata;
- _this->tizen_pre_rotation_data.wl_egl_window_set_rotation(wind->egl_window, rot);
-}
-
-void
_tizen_set_window_size(SDL_Window * window, int w, int h)
{
if(!window)
_tizen_set_window_size(window, window_w, window_h);
+ SDL_VideoData* _this = SDL_GetVideoDevice()->driverdata;
+
if(wind->support_pre_rotation)
{
- Tizen_pre_rotation_set(wind, rotation);
- wl_egl_window_set_buffer_transform(wind->egl_window, _tizen_get_rotation_idx(rotation));
- wl_egl_window_set_window_transform(wind->egl_window, _tizen_get_rotation_idx(wind->rotation));
+ _this->tizen_rotation_data.wl_egl_window_set_rotation(wind->egl_window, 360 - rotation);
+ _this->tizen_rotation_data.wl_egl_window_set_buffer_transform(wind->egl_window, _tizen_get_rotation_idx(rotation));
+ _this->tizen_rotation_data.wl_egl_window_set_window_transform(wind->egl_window, _tizen_get_rotation_idx(wind->rotation));
}
else
{
wl_egl_window_resize(wind->egl_window, window_w, window_h, 0, 0);
- wl_egl_window_set_buffer_transform(wind->egl_window, _tizen_get_rotation_idx((360 - wind->rotation)));
- wl_egl_window_set_window_transform(wind->egl_window, _tizen_get_rotation_idx(0));
+ _this->tizen_rotation_data.wl_egl_window_set_buffer_transform(wind->egl_window, _tizen_get_rotation_idx((360 - wind->rotation)));
+ _this->tizen_rotation_data.wl_egl_window_set_window_transform(wind->egl_window, _tizen_get_rotation_idx(0));
}
-
_tizen_send_rotation_event(window, 0);
SDL_SendWindowEvent(window, SDL_WINDOWEVENT_SIZE_CHANGED, window->w, window->h);
//Support PreRotation
wind->support_pre_rotation = 0;
- if (_tizen_PreRotatotion_LoadLibrary(data, "libwayland-egl.so.1")) {
- if (data->tizen_pre_rotation_data.wl_egl_window_get_capabilities(wind->egl_window) == TIZEN_WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED ) {
+ if (_tizen_Rotatotion_LoadLibrary(data, "libwayland-egl.so.1")) {
+ if (data->tizen_rotation_data.wl_egl_window_get_capabilities(wind->egl_window) == TIZEN_WL_EGL_WINDOW_CAPABILITY_ROTATION_SUPPORTED ) {
wind->support_pre_rotation = 1;
}
}