[Tizen] Support 32 bit window surface 29/125129/1
authorWonsik, Jung <sidein@samsung.com>
Fri, 14 Apr 2017 02:16:10 +0000 (11:16 +0900)
committerWonsik, Jung <sidein@samsung.com>
Fri, 14 Apr 2017 02:19:58 +0000 (11:19 +0900)
To support 32bit window, use EGL atrribute of EGL_ALPHA_SIZE
If EGL_ALPHA_SIZE is valid, opaque regions are NULL

Change-Id: I4306f3c4688f6fdf20af43035699204085fcc4fb

src/video/tizen/SDL_tizenopengles.c
src/video/tizen/SDL_tizenopengles.h
src/video/tizen/SDL_tizenwindow.c

index 2819106..779731d 100755 (executable)
@@ -97,6 +97,26 @@ Tizen_GLES_DeleteContext(_THIS, SDL_GLContext context)
     SDL_EGL_DeleteContext(_this, context);
 }
 
+int
+Tizen_GLES_GetAlphaSize(_THIS)
+{
+    EGLint alpha_size = 0;
+
+    if (!_this->egl_data) {
+        /* The EGL library wasn't loaded, SDL_GetError() should have info */
+        SDL_Log("egl_data is NULL");
+        return NULL;
+    }
+
+    if (_this->egl_data->eglGetConfigAttrib(_this->egl_data->egl_display,
+                                            _this->egl_data->egl_config,
+                                            EGL_ALPHA_SIZE,
+                                            &alpha_size) == EGL_FALSE || !alpha_size) {
+        alpha_size = 0;
+    }
+    return alpha_size;
+}
+
 #endif /* SDL_VIDEO_DRIVER_TIZEN && SDL_VIDEO_OPENGL_EGL */
 
 /* vi: set ts=4 sw=4 expandtab: */
index c9610f7..cd14cae 100755 (executable)
@@ -44,6 +44,7 @@ extern SDL_GLContext Tizen_GLES_CreateContext(_THIS, SDL_Window *window);
 extern void Tizen_GLES_SwapWindow(_THIS, SDL_Window *window);
 extern int Tizen_GLES_MakeCurrent(_THIS, SDL_Window *window, SDL_GLContext context);
 extern void Tizen_GLES_DeleteContext(_THIS, SDL_GLContext context);
+extern int Tizen_GLES_GetAlphaSize(_THIS);
 #endif
 
 #endif /* _SDL_tizenopengles_h */
index 780fab7..cdb46f6 100755 (executable)
@@ -319,7 +319,6 @@ Tizen_CreateWindow(_THIS, SDL_Window *window)
     wind->rotation = 0;
     wind->rotation_supported = 0;
     wind->received_rotation = 0;
-    ecore_wl_window_opaque_region_set(wind->window, window->x, window->y, window->w, window->h);
 
 #if SDL_VIDEO_OPENGL_EGL
     if (window->flags & SDL_WINDOW_OPENGL) {
@@ -332,6 +331,13 @@ Tizen_CreateWindow(_THIS, SDL_Window *window)
             return -1;
         }
 
+        if (!Tizen_GLES_GetAlphaSize(_this)) {
+           ecore_wl_window_opaque_region_set(wind->window, window->x, window->y, window->w, window->h);
+        }
+        else {
+            wl_surface_set_opaque_region(ecore_wl_window_surface_get(wind->window), NULL);
+        }
+
         //Support PreRotation
         wind->support_pre_rotation = 0;
         if (_tizen_rotation_type_get() && _tizen_PreRotatotion_LoadLibrary(wind, "libwayland-egl.so")) {