From 046c3353a0ecd9a9db4855bd5e46715ca2a9fa43 Mon Sep 17 00:00:00 2001 From: "huiyu.eun" Date: Tue, 13 Jun 2017 15:59:22 +0900 Subject: [PATCH] [SDL_Tizen] Delete unused code - Indicator code - Unused variable Change-Id: I15e29040f1b6e44c4389638776946a210ed01b28 Signed-off-by: huiyu.eun --- src/video/tizen/SDL_ecore_ipc.c | 254 ------------------ src/video/tizen/SDL_ecore_ipc.h | 102 ------- src/video/tizen/SDL_tizenindicator.c | 502 ----------------------------------- src/video/tizen/SDL_tizenindicator.h | 49 ---- src/video/tizen/SDL_tizenvideo.h | 6 - src/video/tizen/SDL_tizenwindow.c | 2 - src/video/tizen/SDL_tizenwindow.h | 7 +- 7 files changed, 1 insertion(+), 921 deletions(-) delete mode 100755 src/video/tizen/SDL_ecore_ipc.c delete mode 100755 src/video/tizen/SDL_ecore_ipc.h delete mode 100644 src/video/tizen/SDL_tizenindicator.c delete mode 100644 src/video/tizen/SDL_tizenindicator.h diff --git a/src/video/tizen/SDL_ecore_ipc.c b/src/video/tizen/SDL_ecore_ipc.c deleted file mode 100755 index 328ecd9..0000000 --- a/src/video/tizen/SDL_ecore_ipc.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#include "SDL_ecore_ipc.h" -#include "SDL_tizenindicator.h" - -#include -#include -#include -#include - - -SharedFile* CreateSharedFile(char* SharedFileName, int size) -{ - SharedFile* sharedFile = (SharedFile*)malloc(sizeof(SharedFile)); - if(sharedFile == NULL) - { - return NULL; - } - - mode_t mode; - mode = S_IRUSR | S_IWUSR; - mode |= S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; - - sharedFile->fileDescriptor= shm_open( SharedFileName, O_RDONLY, mode ); - if(sharedFile->fileDescriptor >= 0) - { - sharedFile->fileName = SharedFileName; - sharedFile->size = size; - sharedFile->address = mmap( NULL, size, PROT_READ, MAP_SHARED, sharedFile->fileDescriptor, 0 ); - if(sharedFile->address != MAP_FAILED) - return sharedFile; - else - return NULL; - } - - return sharedFile; -} - -LockFile* CreateLockeFile(char* LockFileName) -{ - LockFile* lockFile = (LockFile*)malloc(sizeof(LockFile)); - if(lockFile == NULL) - return NULL; - - lockFile->fileDescriptor = open(LockFileName, O_RDWR); - if(lockFile->fileDescriptor == -1) - { - SDL_LogError(SDL_LOG_CATEGORY_ASSERT,"[SDL]Fail to open lock file!"); - return NULL; - - } - lockFile->fileName = LockFileName; - - return lockFile; -} - -void SetSharedImageInfo(Ecore_Ipc_Event_Server_Data* epcEvent, SharedIndicatorInfo* shared_info) -{ - if ( (epcEvent->data) && (epcEvent->size > 0) && (((unsigned char *)epcEvent->data)[epcEvent->size - 1] == 0) ) - { - int n = epcEvent->response; - if( n < SHARED_FILE_NUMBER) - { - shared_info->fileInfo[n].SharedFileName = (char*)epcEvent->data; - shared_info->fileInfo[n].SharedFileID = epcEvent->ref; - shared_info->fileInfo[n].SharedFileNumber = epcEvent->ref_to; - } - } -} - -void SetLockFileInfo(Ecore_Ipc_Event_Server_Data* epcEvent, SharedIndicatorInfo *shared_info) -{ - if((epcEvent->ref > 0) && (epcEvent->ref_to > 0) && (epcEvent->data) && (((unsigned char *)epcEvent->data)[epcEvent->size - 1] == 0)) - { - int n = epcEvent->response; - if(n < SHARED_FILE_NUMBER) - { - shared_info->fileInfo[n].ImageWidth = epcEvent->ref; - shared_info->fileInfo[n].ImageHeight = epcEvent->ref_to; - shared_info->fileInfo[n].LockFileName = epcEvent->data; - } - } -} - -unsigned char* CopyBuffer(SharedFileInfo* fileInfo) -{ - return (unsigned char*)fileInfo->sharedFile->address; -} - -void Tizen_Indicator_SharedFile_Free(SharedIndicatorInfo *shared_info, int n) -{ - LockFile* lockFile = shared_info->fileInfo[n].lockFile; - if(lockFile!=NULL) { - if(lockFile->fileDescriptor>=0) { - if(lockf(lockFile->fileDescriptor, F_ULOCK, 0) <0 ) - { - SDL_LogError(SDL_LOG_CATEGORY_ASSERT,"[SDL] Lock release fail"); - return; - } - } - free(lockFile); - lockFile = NULL; - } - - SharedFile* sharedFile = shared_info->fileInfo[n].sharedFile; - - if(sharedFile!=NULL) { - if (sharedFile->address != MAP_FAILED) munmap(sharedFile->address, sharedFile->size); - if (sharedFile->fileDescriptor >= 0) close(sharedFile->fileDescriptor); - - sharedFile->address = MAP_FAILED; - sharedFile->fileDescriptor = 1; - sharedFile->fileName = NULL; - sharedFile->size = 0; - free(sharedFile); - sharedFile = NULL; - } -} - -void LoadSharedImage(Ecore_Ipc_Event_Server_Data* epcEvent, SharedIndicatorInfo *shared_info) -{ - char sharedFilename[256]; - int n = epcEvent->response; - if(n < SHARED_FILE_NUMBER) - { - snprintf(sharedFilename, 256, "/%s-%d.%d", shared_info->fileInfo[n].SharedFileName, shared_info->fileInfo[n].SharedFileID, shared_info->fileInfo[n].SharedFileNumber); - - Tizen_Indicator_SharedFile_Free(shared_info, n); - - shared_info->fileInfo[n].sharedFile = CreateSharedFile(sharedFilename, shared_info->fileInfo[n].ImageWidth * shared_info->fileInfo[n].ImageHeight * 4); - if(shared_info->fileInfo[n].sharedFile != NULL) - { - shared_info->fileInfo[n].lockFile = CreateLockeFile(shared_info->fileInfo[n].LockFileName); - } - else - { - SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "[SDL]fileInfo->sharedFile == NULL"); - } - } -} - -void DataReceived(void* event, SharedIndicatorInfo* shared_info) -{ - Ecore_Ipc_Event_Server_Data* epcEvent = (Ecore_Ipc_Event_Server_Data*)event; - switch(epcEvent->minor) - { - case OP_SHM_REF0: - { - SetSharedImageInfo(epcEvent, shared_info); - break; - } - case OP_SHM_REF1: - { - SetLockFileInfo(epcEvent, shared_info); - break; - } - case OP_SHM_REF2: - { - LoadSharedImage(epcEvent, shared_info); - break; - } - case OP_UPDATE: - { - //int n = epcEvent->response; - break; - } - case OP_UPDATE_DONE: - { - int n = epcEvent->response; - if( n < SHARED_FILE_NUMBER) - { - shared_info->cur_idx = n; - } - break; - } - case OP_GL_REF: - { - break; - } - case OP_RESIZE: - { - break; - } - } -} - -Eina_Bool handler_server_add(void *data, int ev_type EINA_UNUSED, void *ev) -{ - //Ecore_Ipc_Event_Server_Add *e = (Ecore_Ipc_Event_Server_Add *)ev; - return 1; -} - -Eina_Bool handler_server_del(void *data, int ev_type EINA_UNUSED, void *ev) -{ - //Ecore_Ipc_Event_Server_Del *e = (Ecore_Ipc_Event_Server_Del *)ev; - return 1; -} - -Eina_Bool handler_server_data(void *data, int ev_type EINA_UNUSED, void *ev) -{ - SharedIndicatorInfo* shared_info = (SharedIndicatorInfo*)data; - DataReceived(ev, shared_info); - return 1; -} - -Ecore_Ipc_Server* serverConnection(const char* serviceName, SharedIndicatorInfo* shared_info) -{ - Ecore_Ipc_Type ipctype = ECORE_IPC_LOCAL_USER; - - if(!ecore_ipc_init()) - { - SDL_LogError(SDL_LOG_CATEGORY_ASSERT, "cannot init ecore_con!"); - ecore_shutdown(); - return NULL; - } - - Ecore_Ipc_Server* IpcServer = ecore_ipc_server_connect(ipctype, (char*)serviceName, 0, NULL); - - if(IpcServer) - { - ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD, handler_server_add, NULL); - ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DEL, handler_server_del, NULL); - ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_DATA, handler_server_data, shared_info); - } - else - { - ecore_shutdown(); - ecore_ipc_shutdown(); - } - - return IpcServer; -} - - diff --git a/src/video/tizen/SDL_ecore_ipc.h b/src/video/tizen/SDL_ecore_ipc.h deleted file mode 100755 index 3a22e67..0000000 --- a/src/video/tizen/SDL_ecore_ipc.h +++ /dev/null @@ -1,102 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ - -#ifndef _ECORE_IPC_H_ -#define _ECORE_IPC_H_ - -#include -#include - -#define MAJOR 0x2011 -#define SHARED_FILE_NUMBER 2 - -typedef struct -{ - char* fileName; - int fileDescriptor; -}LockFile; - -typedef struct -{ - char* fileName; - int fileDescriptor; - void* address; - int size; -}SharedFile; - -typedef struct -{ - int ImageWidth; - int ImageHeight; - - char* LockFileName; - char* SharedFileName; - int SharedFileID; - int SharedFileNumber; - - SharedFile* sharedFile; - LockFile* lockFile; - -}SharedFileInfo; - -typedef struct -{ - SharedFileInfo fileInfo[2]; - int cur_idx; -}SharedIndicatorInfo; - -enum // opcodes -{ - OP_RESIZE, - OP_SHOW, - OP_HIDE, - OP_FOCUS, - OP_UNFOCUS, - OP_UPDATE, - OP_UPDATE_DONE, - OP_SHM_REF0, - OP_SHM_REF1, - OP_SHM_REF2, - OP_PROFILE_CHANGE_REQUEST, - OP_PROFILE_CHANGE_DONE, - OP_EV_MOUSE_IN, - OP_EV_MOUSE_OUT, - OP_EV_MOUSE_UP, - OP_EV_MOUSE_DOWN, - OP_EV_MOUSE_MOVE, - OP_EV_MOUSE_WHEEL, - OP_EV_MULTI_UP, - OP_EV_MULTI_DOWN, - OP_EV_MULTI_MOVE, - OP_EV_KEY_UP, - OP_EV_KEY_DOWN, - OP_EV_HOLD, - OP_MSG_PARENT, - OP_MSG, - OP_GL_REF, -}; - -unsigned char* CopyBuffer(SharedFileInfo* fileInfo); -Ecore_Ipc_Server* serverConnection(const char* serviceName, SharedIndicatorInfo* shared_info); -void Tizen_Indicator_SharedFile_Free(SharedIndicatorInfo *shared_info, int n); - -#endif diff --git a/src/video/tizen/SDL_tizenindicator.c b/src/video/tizen/SDL_tizenindicator.c deleted file mode 100644 index 37e8fe0..0000000 --- a/src/video/tizen/SDL_tizenindicator.c +++ /dev/null @@ -1,502 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#if SDL_VIDEO_OPENGL_EGL - -#include -#include - -#include "SDL_egl.h" -#include "SDL_log.h" -#include "SDL_timer.h" - -#include "../SDL_egl_c.h" - -#include "SDL_tizenindicator.h" -#include "SDL_tizenwindow.h" - -#if SDL_VIDEO_OPENGL -#include "SDL_opengl.h" -#endif /* SDL_VIDEO_OPENGL */ - -#if SDL_VIDEO_OPENGL_ES -#include "SDL_opengles.h" -#endif /* SDL_VIDEO_OPENGL_ES */ - -/* GL and GLES2 headers conflict on Linux 32 bits */ -#if SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL -#include "SDL_opengles2.h" -#endif /* SDL_VIDEO_OPENGL_ES2 && !SDL_VIDEO_OPENGL */ - -/* EGL implementation of SDL OpenGL ES support */ -typedef struct GLES2_Context -{ - #define SDL_PROC(ret,func,params) ret (APIENTRY *func) params; - #include "../../render/opengles2/SDL_gles2funcs.h" - #undef SDL_PROC -} GLES2_Context; - -static int LoadContext(GLES2_Context * data) -{ - #define SDL_PROC(ret,func,params) \ - do { \ - data->func = SDL_GL_GetProcAddress(#func); \ - if ( ! data->func ) { \ - return SDL_SetError("Couldn't load GLES2 function %s: %s\n", #func, SDL_GetError()); \ - } \ - } while ( 0 ); - - #include "../../render/opengles2/SDL_gles2funcs.h" - #undef SDL_PROC - - return 0; -} - -#define IINDICATOR_HEIGHT 52 - -typedef struct -{ - GLfloat m[4][4]; -}ModelMatrix; -ModelMatrix mMatrix; - -GLfloat vVertices[12]={ - 1.0f, 1.0f, - -1.0f, -1.0f, - 1.0f, -1.0f, - 1.0f, 1.0f, - -1.0f, 1.0f, - -1.0f, -1.0f - }; - -GLfloat vCoord[12] = { - 1.0f, 0.0f, - 0.0f, 1.0f, - 1.0f, 1.0f, - 1.0f, 0.0f, - 0.0f, 0.0f, - 0.0f, 1.0f - }; - -SharedIndicatorInfo shared_info; -GLuint textureID; -GLuint indicator_vbo, indicator_ibo; - -GLuint programObject; -GLuint vIndex; -GLuint cIndex; - -GLfloat _tizen_cal_indicator_ratio(SDL_Window *window) -{ - SDL_WindowData *wind = window->driverdata; - GLfloat ratio = 1 - (GLfloat)(IINDICATOR_HEIGHT*2) / window->h; - - if (!wind->support_pre_rotation && (wind->rotation==90 || wind->rotation==270)) - ratio = 1 - (GLfloat)(IINDICATOR_HEIGHT*2) / window->w; - return ratio; -} - -Eina_Bool _tizen_timer_callback_indicator(void *data) -{ - SDL_VideoDevice *_this = SDL_GetVideoDevice(); - - Tizen_DrawIndicator(_this->windows); - SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) _this->windows->driverdata)->egl_surface); - - return ECORE_CALLBACK_RENEW; -} - -int -Tizen_indicator_event_filter() -{ - SDL_Window *window = SDL_GetVideoDevice()->windows; - SDL_WindowData *wind = window->driverdata; - - if(wind->indicator_show && wind->indicator_timer == NULL) - { - wind->indicator_timer = ecore_timer_add(0.02, _tizen_timer_callback_indicator, NULL); - } - else if(!wind->indicator_show && wind->indicator_timer != NULL) - { - ecore_timer_del(wind ->indicator_timer); - wind->indicator_timer = NULL; - } - - return 1; -} - -static GLuint LoadShader(GLES2_Context* Mainctx, const char *shaderSrc, GLenum type) -{ - GLuint shader; - GLint compiled; - - shader = Mainctx->glCreateShader(type); - SDL_Log("shader == %d", shader); - if(shader == 0) - return 0; - Mainctx->glShaderSource(shader, 1, &shaderSrc, NULL); - Mainctx->glCompileShader(shader); - Mainctx->glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); - if(!compiled) - { - GLint infoLen = 0; - Mainctx->glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); - if(infoLen > 1) - { - char* infoLog = (char*)(malloc(sizeof(char) * infoLen)); - Mainctx->glGetShaderInfoLog(shader, infoLen, NULL, infoLog); - SDL_Log("Error compiling shader: %s", infoLog ); - free(infoLog); - } - Mainctx->glDeleteShader(shader); - return 0; - } - return shader; - -} - -extern void ModelMatrixLoadIdentity(ModelMatrix* matrix) -{ - matrix->m[0][0] = 1.0f; - matrix->m[0][1] = 0.0f; - matrix->m[0][2] = 0.0f; - matrix->m[0][3] = 0.0f; - - matrix->m[1][0] = 0.0f; - matrix->m[1][1] = 1.0f; - matrix->m[1][2] = 0.0f; - matrix->m[1][3] = 0.0f; - - matrix->m[2][0] = 0.0f; - matrix->m[2][1] = 0.0f; - matrix->m[2][2] = 1.0f; - matrix->m[2][3] = 0.0f; - - matrix->m[3][0] = 0.0f; - matrix->m[3][1] = 0.0f; - matrix->m[3][2] = 0.0f; - matrix->m[3][3] = 1.0f; -} - -/* -static void ModelMatrixTranslate(ModelMatrix* matrix, GLfloat x, GLfloat y, GLfloat z) -{ - matrix->m[3][0] += (matrix->m[0][0] * x + matrix->m[1][0] * y + matrix->m[2][0] * z); - matrix->m[3][1] += (matrix->m[0][1] * x + matrix->m[1][1] * y + matrix->m[2][1] * z); - matrix->m[3][2] += (matrix->m[0][2] * x + matrix->m[1][2] * y + matrix->m[2][2] * z); - matrix->m[3][3] += (matrix->m[0][3] * x + matrix->m[1][3] * y + matrix->m[2][3] * z); -} -*/ - -void ModelMatrixTranslateInit(SDL_Window *window, int rot) -{ - //vVertices count - int i=1; - for( ; i<12; i+=2) - vVertices[i] = 1.0f; - - vVertices[3] = vVertices[5] = vVertices[11] = _tizen_cal_indicator_ratio(window); -} - -void ModelMatrixMultiply(ModelMatrix *lhs, ModelMatrix *rhs, ModelMatrix *r) -{ - int i, j, k; - float tmp[4][4]; - - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { - tmp[j][i] = 0.0; - - for (k = 0; k < 4; k++) { - tmp[j][i] += lhs->m[k][i] * rhs->m[j][k]; - } - } - } - for (i = 0; i < 4; i++) { - for (j=0; j<4; j++) { - r->m[i][j] = tmp[i][j]; - } - } -} - -void rotate_indicator(ModelMatrix* matrix, const float anglex, const float angley, const float anglez) -{ - const float pi = 3.141592f; - ModelMatrix* temp = (ModelMatrix*)malloc(sizeof(ModelMatrix)); - float rz = 2.0f * pi * anglez / 360.0f; - float rx = 2.0f * pi * anglex / 360.0f; - float ry = 2.0f * pi * angley / 360.0f; - float sy = SDL_sinf(ry); - float cy = SDL_cosf(ry); - float sx = SDL_sinf(rx); - float cx = SDL_cosf(rx); - float sz = SDL_sinf(rz); - float cz = SDL_cosf(rz); - - ModelMatrixLoadIdentity(temp); - - temp->m[0][0] = cy * cz - sx * sy * sz; - temp->m[0][1] = cz * sx * sy + cy * sz; - temp->m[0][2] = -cx * sy; - temp->m[1][0] = -cx * sz; - temp->m[1][1] = cx * cz; - temp->m[1][2] = sx; - - temp->m[2][0] = cz * sy + cy * sx * sz; - temp->m[2][1] = -cy * cz * sx + sy * sz; - temp->m[2][2] = cx * cy; - - ModelMatrixMultiply(matrix, temp, matrix); - free(temp); -} - -void Tizen_UploadIndicatorImage(int idx) -{ - if(!shared_info.fileInfo[idx].sharedFile - || shared_info.fileInfo[idx].ImageWidth == 0 - || shared_info.fileInfo[idx].ImageHeight == 0) - return ; - - GLES2_Context Mainctx; - LoadContext(&Mainctx); - - Mainctx.glActiveTexture(GL_TEXTURE0); - - Mainctx.glBindTexture(GL_TEXTURE_2D, textureID); - Mainctx.glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, shared_info.fileInfo[idx].ImageWidth, shared_info.fileInfo[idx].ImageHeight, - 0, GL_RGBA, GL_UNSIGNED_BYTE, (unsigned char*)(shared_info.fileInfo[idx].sharedFile->address)); -} - -SDL_bool Tizen_isTouchIndicator(SDL_Window *window, SDL_WindowData *wind, int rot, int x, int y) -{ - if((window->flags & SDL_WINDOW_FULLSCREEN) || (window->flags & SDL_WINDOW_BORDERLESS)) - return SDL_FALSE; - - if(wind->support_pre_rotation && x > window->x && x < window->x + window->w && y > window->y && y < window->y + IINDICATOR_HEIGHT) - return SDL_TRUE; - - if(rot==0 && x > window->x && x < window->x + window->w && y > window->y && y < window->y + IINDICATOR_HEIGHT) - return SDL_TRUE; - if(rot==90 && x > window->x && x < window->x + IINDICATOR_HEIGHT && y > window->y && y < window->y + window->h) - return SDL_TRUE; - if(rot==270 && x > window->x + window->w -IINDICATOR_HEIGHT && x < window->x + window->w && y > window->y && y < window->y + window->h) - return SDL_TRUE; - - return SDL_FALSE; -} - -int Tizen_Indicator_GLES_Init(SDL_Window* window) -{ - SDL_WindowData *wind = window->driverdata; - if(!wind->need_indicator) return 0; - - int screen_w, screen_h; - ecore_wl_screen_size_get(&screen_w, &screen_h); - - if(window->w < screen_w || window->h < screen_h) - return 0; - - ecore_wl_indicator_visible_type_set(wind->window, ECORE_WL_INDICATOR_VISIBLE_TYPE_SHOWN); - ecore_wl_window_indicator_opacity_set(wind->window, ECORE_WL_INDICATOR_OPAQUE); - ecore_wl_window_indicator_state_set(wind->window, ECORE_WL_INDICATOR_STATE_ON); - - Ecore_Ipc_Server* IpcServer = serverConnection("elm_indicator", &shared_info); - if(!IpcServer) - { - SDL_Log("Fail to connect elm_indicator!\n"); - return 0; - } - - GLchar vShaderStr[] = - "attribute vec4 vVertices;\n" - "attribute vec2 vCoord;\n" - "uniform mat4 modelMatrix;\n" - "varying vec2 Coord;\n" - "void main()\n" - "{\n" - " gl_Position = modelMatrix * vVertices;\n" - " Coord = vCoord;\n" - "}\n"; - - GLchar fShaderStr[] = - "precision mediump float;\n" - "varying vec2 Coord;\n" - "uniform sampler2D s_texture;\n" - "void main()\n" - "{\n" - " gl_FragColor = texture2D(s_texture,Coord);\n" - "}\n"; - - GLuint vertexShader; - GLuint fragmentShader; - - GLint linked; - - GLES2_Context Mainctx; - LoadContext(&Mainctx); - - vertexShader = LoadShader(&Mainctx, vShaderStr, GL_VERTEX_SHADER); - fragmentShader = LoadShader(&Mainctx, fShaderStr, GL_FRAGMENT_SHADER); - SDL_Log("The vertex shader is %d", vertexShader); - SDL_Log("The fragment shader is %d", fragmentShader); - - programObject = Mainctx.glCreateProgram(); - if(programObject == 0) - return 0; - - Mainctx.glUseProgram(programObject); - - Mainctx.glAttachShader(programObject, vertexShader); - Mainctx.glAttachShader(programObject, fragmentShader); - - Mainctx.glLinkProgram(programObject); - Mainctx.glGetProgramiv(programObject, GL_LINK_STATUS, &linked); - - if(!linked) - { - GLint infoLen = 0; - Mainctx.glGetProgramiv(programObject, GL_INFO_LOG_LENGTH, &infoLen); - if(infoLen > 1) - { - char* infoLog = (char*)(malloc(sizeof(char) * infoLen)); - Mainctx.glGetProgramInfoLog(programObject, infoLen, NULL, infoLog); - SDL_Log("Error linking program: %s", infoLog); - free(infoLog); - } - Mainctx.glDeleteProgram(programObject); - return 0; - } - - Mainctx.glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - Mainctx.glEnable(GL_DEPTH_TEST); - - vIndex = Mainctx.glGetAttribLocation(programObject, "vVertices"); - cIndex = Mainctx.glGetAttribLocation(programObject, "vCoord"); - - Mainctx.glBindAttribLocation(programObject, vIndex, "vVertices"); - Mainctx.glBindAttribLocation(programObject, cIndex, "vCoord"); - - ModelMatrixLoadIdentity(&mMatrix); - - Mainctx.glGenTextures(1, &textureID); - Mainctx.glActiveTexture(GL_TEXTURE0); - Mainctx.glBindTexture(GL_TEXTURE_2D, textureID); - - Mainctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - Mainctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - Mainctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - Mainctx.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - - wind->indicator_show = SDL_TRUE; - wind->last_indicator_showtime = SDL_GetTicks(); - - ecore_main_loop_iterate(); - Tizen_IndicatorProcessEvent(window, wind->rotation); - - wind->need_indicator = SDL_FALSE; - return 1; -} - -void Tizen_DrawIndicator(SDL_Window *window) -{ - SDL_WindowData* wdata = (SDL_WindowData*)window->driverdata; - if(!(window->flags & SDL_WINDOW_FULLSCREEN) && !(window->flags & SDL_WINDOW_BORDERLESS) && wdata->indicator_show) - { - if(wdata->last_indicator_showtime + 3000 < SDL_GetTicks()) - { - int i=1; - for( ; i<12; i+=2) - vVertices[i] += 0.02; - } - if(wdata->last_indicator_showtime + 3500 < SDL_GetTicks()) - { - wdata->indicator_show = SDL_FALSE; - } - GLES2_Context Mainctx; - LoadContext(&Mainctx); - Mainctx.glViewport(0, 0, window->w, window->h); - Mainctx.glUseProgram(programObject); - - Mainctx.glBindBuffer(GL_ARRAY_BUFFER, 0); - Mainctx.glVertexAttribPointer(vIndex, 2, GL_FLOAT, GL_FALSE, 0, vVertices); - Mainctx.glVertexAttribPointer(cIndex, 2, GL_FLOAT, GL_FALSE, 0, vCoord); - - GLint uniformLocation = Mainctx.glGetUniformLocation(programObject, "modelMatrix"); - Mainctx.glUniformMatrix4fv(uniformLocation, 1, GL_FALSE, (GLfloat *)mMatrix.m); - - Mainctx.glEnableVertexAttribArray(vIndex); - Mainctx.glEnableVertexAttribArray(cIndex); - Tizen_UploadIndicatorImage(shared_info.cur_idx); - - GLboolean isDepthTest = Mainctx.glIsEnabled(GL_DEPTH_TEST); - if(isDepthTest) Mainctx.glDisable(GL_DEPTH_TEST); - Mainctx.glDrawArrays(GL_TRIANGLES, 0, 6); - - if(isDepthTest) Mainctx.glEnable(GL_DEPTH_TEST); - Mainctx.glDisableVertexAttribArray(vIndex); - Mainctx.glDisableVertexAttribArray(cIndex); - } -} - -void -Tizen_IndicatorProcessEvent(SDL_Window *window, int rot) -{ - SDL_WindowData *wind = window->driverdata; - if(!(window->flags & SDL_WINDOW_FULLSCREEN) && !(window->flags & SDL_WINDOW_BORDERLESS) && wind->indicator_show) - { - GLES2_Context Mainctx; - LoadContext(&Mainctx); - - vVertices[3] = vVertices[5] = vVertices[11] = _tizen_cal_indicator_ratio(window); - - Mainctx.glBindBuffer(GL_ARRAY_BUFFER, indicator_vbo); - Mainctx.glBufferData(GL_ARRAY_BUFFER, 12 * 4, vVertices, GL_STATIC_DRAW); - Mainctx.glBindBuffer(GL_ARRAY_BUFFER, indicator_ibo); - Mainctx.glBufferData(GL_ARRAY_BUFFER, 12 * 4, vCoord, GL_STATIC_DRAW); - - ModelMatrixLoadIdentity(&mMatrix); - - if (!wind->support_pre_rotation) - rotate_indicator(&mMatrix, 0, 0, rot); - - wind->indicator_show = SDL_TRUE; - wind->last_indicator_showtime = SDL_GetTicks(); - - } -} - -int Tizen_FiniIndicator() -{ - int n; - for (n=0; n < SHARED_FILE_NUMBER; n++) - Tizen_Indicator_SharedFile_Free(&shared_info, n); - - - GLES2_Context Mainctx; - LoadContext(&Mainctx); - Mainctx.glDeleteProgram(programObject); - return SDL_TRUE; -} - -#endif /* SDL_VIDEO_DRIVER_TIZEN && SDL_VIDEO_OPENGL_EGL */ - diff --git a/src/video/tizen/SDL_tizenindicator.h b/src/video/tizen/SDL_tizenindicator.h deleted file mode 100644 index 4fa15ea..0000000 --- a/src/video/tizen/SDL_tizenindicator.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - Simple DirectMedia Layer - Copyright (C) 1997-2016 Sam Lantinga - Copyright 2015 Samsung Electronics co., Ltd. All Rights Reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. -*/ -#include "../../SDL_internal.h" - -#ifndef _SDL_tizenindicator_h -#define _SDL_tizenindicator_h - -#if SDL_VIDEO_OPENGL_EGL - -#include "../SDL_sysvideo.h" - -#include "SDL_ecore_ipc.h" -#include "SDL_tizenwindow.h" - -extern void ModelMatrixTranslateInit(SDL_Window *window, int rot); - -extern SDL_bool Tizen_isTouchIndicator(SDL_Window *window, SDL_WindowData *wind, int rot, int x, int y); - -extern int Tizen_Indicator_GLES_Init(SDL_Window* window); -extern int Tizen_indicator_event_filter(void); -extern int Tizen_FiniIndicator(void); - -extern void Tizen_DrawIndicator(SDL_Window *window); -extern void Tizen_IndicatorProcessEvent(SDL_Window* window, int rot); - - -#endif - -#endif /* _SDL_tizenindicator_h */ - diff --git a/src/video/tizen/SDL_tizenvideo.h b/src/video/tizen/SDL_tizenvideo.h index a58382a..aeb0491 100755 --- a/src/video/tizen/SDL_tizenvideo.h +++ b/src/video/tizen/SDL_tizenvideo.h @@ -32,13 +32,7 @@ typedef struct { struct wl_display *display; - - EGLDisplay edpy; - EGLContext context; - EGLConfig econf; - Eina_Hash *windows; - unsigned int current_thread; } SDL_VideoData; /* Initialization/Query functions */ diff --git a/src/video/tizen/SDL_tizenwindow.c b/src/video/tizen/SDL_tizenwindow.c index d34fb4e..f151f0d 100755 --- a/src/video/tizen/SDL_tizenwindow.c +++ b/src/video/tizen/SDL_tizenwindow.c @@ -769,8 +769,6 @@ Tizen_InitWindow(_THIS) ecore_event_handler_add(ECORE_WL_EVENT_MOUSE_OUT, _tizen_cb_event_mouse_out,_this); - data->current_thread = SDL_GetThreadID(0); - return 0; } diff --git a/src/video/tizen/SDL_tizenwindow.h b/src/video/tizen/SDL_tizenwindow.h index 6b0c14f..6f04f97 100755 --- a/src/video/tizen/SDL_tizenwindow.h +++ b/src/video/tizen/SDL_tizenwindow.h @@ -42,19 +42,14 @@ typedef struct { uint32_t id; Ecore_Wl_Window *window; struct wl_surface *surface; - struct wl_shell_surface *shell_surface; struct wl_egl_window *egl_window; + EGLSurface egl_surface; int rotation; int rotation_supported; int received_rotation; - void *indicator_timer; int output_rotation; - SDL_bool need_indicator; - SDL_bool indicator_show; - Uint32 last_indicator_showtime; - int support_pre_rotation; SDL_bool isLoaded_pre_rotation; Tizen_Prerotation_Data * tizen_pre_rotation_data; -- 2.7.4