fix OnBoundsChanged bugs
authorSukwon Suh <sukwon.suh@samsung.com>
Thu, 28 Mar 2013 13:07:18 +0000 (22:07 +0900)
committerSukwon Suh <sukwon.suh@samsung.com>
Thu, 28 Mar 2013 13:32:22 +0000 (22:32 +0900)
Change-Id: Ica94f0483da4f2e17b62fc5b08f805b639e38487
Signed-off-by: Sukwon Suh <sukwon.suh@samsung.com>
src/graphics/opengl/FGrpEgl.cpp

index 5492cd5..2626c98 100644 (file)
@@ -352,12 +352,13 @@ _OnBoundsChanged(void* pData)
        }
 
        EGLDisplay eglDisplay = eglGetCurrentDisplay();
-       _SglIndex readSurface = (_SglIndex)_SglGetCurrentSurface(EGL_READ);
-       _SglIndex drawSurface = (_SglIndex)_SglGetCurrentSurface(EGL_DRAW);
+       EGLSurface readSurface = eglGetCurrentSurface(EGL_READ);
+       EGLSurface drawSurface = eglGetCurrentSurface(EGL_DRAW);
        EGLSurface eglContext = eglGetCurrentContext();
 
        eglMakeCurrent(pSglInfo->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
        EGLBoolean ret = eglDestroySurface(pSglInfo->display, pSglInfo->surface);
+       pSglInfo->surface = null;
        SysTryReturnVoidResult(NID_GRP, ret == EGL_TRUE, E_OPERATION_FAILED, "eglDestroySurface failed.");
 
        FloatRectangle rect = pSglInfo->pVisualElement->GetBounds();
@@ -365,13 +366,14 @@ _OnBoundsChanged(void* pData)
        int height = int(rect.height);
        SysTryReturnVoidResult(NID_GRP, width > 0 && height > 0, E_OUT_OF_RANGE, "Invalid size. w:%d h:%d", width, height);
 
-       delete pSglInfo->pVisualElementSurface;
-       pSglInfo->pVisualElementSurface = null;
-
        Evas* pEvas = evas_object_evas_get(pSglInfo->pObject);
        Evas_Object* pObject = evas_object_image_filled_add(pEvas);
        SysTryReturnVoidResult(NID_GRP, pObject != null, E_INVALID_STATE, "Invalid object.");
 
+       delete pSglInfo->pVisualElementSurface;
+       pSglInfo->pVisualElementSurface = null;
+       pSglInfo->pObject = null;
+
        int widthPhysical = static_cast<int> (CoordinateSystem::ConvertToPhysicalX(rect.width));
        int heightPhysical = static_cast<int> (CoordinateSystem::ConvertToPhysicalY(rect.height));
 
@@ -415,10 +417,12 @@ _OnBoundsChanged(void* pData)
 
                eglMakeCurrent(pSglInfo->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
                ret = eglDestroySurface(pSglInfoSecond->display, pSglInfoSecond->surface);
+               pSglInfoSecond->surface = null;
                SysTryReturnVoidResult(NID_GRP, ret == EGL_TRUE, E_OPERATION_FAILED, "eglDestroySurface failed.");
 
                delete pSglInfoSecond->pVisualElementSurface;
                pSglInfoSecond->pVisualElementSurface = null;
+               pSglInfoSecond->pObject = null;
 
                pObject = evas_object_image_filled_add(pEvas);
                SysTryReturnVoidResult(NID_GRP, pObject != null, E_INVALID_STATE, "Invalid object.");
@@ -470,7 +474,7 @@ _OnBoundsChanged(void* pData)
        pSglInfo->pBitmap = bitmap.release();
        _EvasObjectImageChange(pSglInfo);
 
-       _SglMakeCurrent(eglDisplay, (EGLSurface)drawSurface, (EGLSurface)readSurface, eglContext);
+       eglMakeCurrent(eglDisplay, drawSurface, readSurface, eglContext);
 
        return;
 }