modify eglMakeCurrent behavior and remove Evas_Engine_GL_X11.h
authorSukwon Suh <sukwon.suh@samsung.com>
Tue, 21 May 2013 02:37:55 +0000 (11:37 +0900)
committerSukwon Suh <sukwon.suh@samsung.com>
Tue, 21 May 2013 02:37:55 +0000 (11:37 +0900)
Change-Id: I74ab76a52c6fa1d7157bd76a112a7f62a392a64f
Signed-off-by: Sukwon Suh <sukwon.suh@samsung.com>
src/graphics/opengl/FGrpEgl.cpp

index 944a626..a2a72c3 100644 (file)
@@ -41,7 +41,6 @@
 
 #include <Ecore_Evas.h>
 #include <Ecore_X.h>
-#include <Evas_Engine_GL_X11.h>
 
 #include <FBaseSysLog.h>
 #include <FGrpBitmap.h>
@@ -128,6 +127,7 @@ void _SaveCurrentContext(_SglInfo* pSglInfo);
 void _UnregisterRenderCallback(Evas_Object* pObject);
 int __registerCallbackCount = 0;
 _SglInfo* __pPreviousSglInfo = null;
+EGLSurface __pPreviousMakeCurrent = EGL_NO_SURFACE;
 #endif
 
 #if !defined (_OSP_EMUL_)
@@ -346,6 +346,11 @@ _OnBoundsChanged(void* pData)
        EGLSurface readSurface = _SglGetCurrentSurface(EGL_READ);
        EGLSurface eglContext = eglGetCurrentContext();
 
+       if (__pPreviousMakeCurrent == drawSurface)
+       {
+               __pPreviousMakeCurrent = EGL_NO_SURFACE;
+       }
+
        if (drawSurface != EGL_NO_SURFACE && readSurface != EGL_NO_SURFACE)
        {
                needSglMakeCurrent = true;
@@ -396,7 +401,7 @@ _OnBoundsChanged(void* pData)
        pSglInfo->isBackbuffer = true;
        pSglInfo->wasShown = false;
        pSglInfo->swapDone = false;
-       pSglInfo->isFirstSwap =  true;
+       pSglInfo->isFirstSwap = true;
 
        if (__isDoublePixmapEnabled)
        {
@@ -429,7 +434,7 @@ _OnBoundsChanged(void* pData)
                pSglInfoSecond->wasShown = false;
                pSglInfoSecond->swapDone = true;
 
-               pSglInfo->isFirstSwap =  true;
+               pSglInfo->isFirstSwap = true;
 
                _EvasObjectImageChange(pSglInfoSecond);
        }
@@ -789,18 +794,11 @@ _EvasObjectImageChange(_SglInfo* pSglInfo)
                        return;
                }
 
-               Evas_Engine_Info_GL_X11* pEvasInfo = (Evas_Engine_Info_GL_X11*)evas_engine_info_get(pEvas);
-               if (pEvasInfo == null)
-               {
-                       SysLog(NID_GRP, "Getting evas engine info failed!");
-                       return;
-               }
-
                Evas_Native_Surface nativeSurface = {0, };
                nativeSurface.type = EVAS_NATIVE_SURFACE_X11;
                nativeSurface.version = EVAS_NATIVE_SURFACE_VERSION;
                nativeSurface.data.x11.pixmap = (unsigned long)pSglInfo->nativePixmap;
-               nativeSurface.data.x11.visual = pEvasInfo->info.visual;
+               nativeSurface.data.x11.visual = ecore_x_default_visual_get(ecore_x_display_get(), ecore_x_default_screen_get());
                evas_object_image_native_surface_set(pSglInfo->pObject, &nativeSurface);
        }
        else
@@ -1668,6 +1666,11 @@ CATCH_01:
 EGLBoolean
 _SglDestroySurface(EGLDisplay dpy, EGLSurface surface)
 {
+       if (__pPreviousMakeCurrent == surface)
+       {
+               __pPreviousMakeCurrent = EGL_NO_SURFACE;
+       }
+
        EGLBoolean ret = EGL_FALSE;
        _SglInfoTableManipulator* pSglInfoTableManipulatorInstance = _SglInfoTableManipulator::GetInstance();
 
@@ -1875,6 +1878,12 @@ _SglDestroyContext(EGLDisplay dpy, EGLContext ctx)
 EGLBoolean
 _SglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
 {
+       if (__pPreviousMakeCurrent == draw)
+       {
+               return EGL_TRUE;
+       }
+       __pPreviousMakeCurrent = draw;
+
        _SglInfoTableManipulator* pSglInfoTableManipulatorInstance = _SglInfoTableManipulator::GetInstance();
 
        _SglIndex sglIndexDraw = (_SglIndex)draw;
@@ -1893,7 +1902,7 @@ _SglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx
                }
                sglInfoReadSurface = sglInfoRead->surface;
 
-               if (__isDoublePixmapEnabled && !sglInfoRead->isBackbuffer)
+               if (__isDoublePixmapEnabled && !sglInfoRead->isBackbuffer && sglInfoRead->pSecondSglInfo != null)
                {
                        sglInfoReadSurface = sglInfoRead->pSecondSglInfo->surface;
                }