SysTryReturnVoidResult(NID_GRP, pObject != null, E_OPERATION_FAILED, "Invalid object.");
+ if (pVisualElement != null)
+ {
+ _VisualElementImpl* pVisualElementImpl = _VisualElementImpl::GetInstance(*pVisualElement);
+ if (pVisualElementImpl != null)
+ {
+ pVisualElementImpl->SetDestroyedCallback(null, null);
+ }
+ }
+
bool needAllocateObject = true;
#if defined(FGRAPHICS_INTERNAL_USE_RESTORE_CONTEXT)
{
if (!isBackbuffer)
{
+ evas_object_del(pObject);
delete pVisualElementSurface;
delete pBitmap;
needAllocateObject = false;
{
if (pVisualElement != null)
{
+ evas_object_del(pObject);
delete pVisualElementSurface;
pVisualElement->SetSurface(null);
}
__pPreviousSglInfo = null;
}
+ bool needSglMakeCurrent = false;
EGLDisplay eglDisplay = eglGetCurrentDisplay();
- EGLSurface readSurface = eglGetCurrentSurface(EGL_READ);
- EGLSurface drawSurface = eglGetCurrentSurface(EGL_DRAW);
+ EGLSurface drawSurface = _SglGetCurrentSurface(EGL_DRAW);
+ EGLSurface readSurface = _SglGetCurrentSurface(EGL_READ);
EGLSurface eglContext = eglGetCurrentContext();
+ if (drawSurface != EGL_NO_SURFACE && readSurface != EGL_NO_SURFACE)
+ {
+ needSglMakeCurrent = true;
+ }
+ else
+ {
+ drawSurface = eglGetCurrentSurface(EGL_DRAW);
+ readSurface = eglGetCurrentSurface(EGL_READ);
+ }
+
eglMakeCurrent(pSglInfo->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
EGLBoolean ret = eglDestroySurface(pSglInfo->display, pSglInfo->surface);
pSglInfo->surface = null;
int width = int(rect.width);
int height = int(rect.height);
SysTryReturnVoidResult(NID_GRP, width > 0 && height > 0, E_OUT_OF_RANGE, "Invalid size. w:%d h:%d", width, height);
-
- 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));
+ SysTryReturnVoidResult(NID_GRP, widthPhysical > 0 && heightPhysical > 0, E_OUT_OF_RANGE, "Invalid size. w:%d h:%d", widthPhysical, heightPhysical);
- evas_object_image_alpha_set(pObject, EINA_TRUE);
- evas_object_image_size_set(pObject, widthPhysical, heightPhysical);
- evas_object_resize(pObject, widthPhysical, heightPhysical);
- evas_object_hide(pObject);
-
- VisualElementSurface* pVisualElementSurface = _VisualElementSurfaceImpl::CreateSurfaceUsingExistingObjectN(
- *pSglInfo->pWindow->GetDisplayContext(), (Handle)pObject, Dimension(width, height));
- SysTryReturnVoidResult(NID_GRP, pVisualElementSurface != null, E_OPERATION_FAILED, "Creating VisualElementSurface failed.");
+ evas_object_image_size_set(pSglInfo->pObject, widthPhysical, heightPhysical);
+ evas_object_resize(pSglInfo->pObject, widthPhysical, heightPhysical);
delete pSglInfo->pBitmap;
pSglInfo->pBitmap = null;
-
std::auto_ptr <Bitmap> bitmap(new (std::nothrow) Bitmap);
SysTryReturnVoidResult(NID_GRP, bitmap.get() != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-
result r = bitmap.get()->Construct(Rectangle(0, 0, width, height));
SysTryReturnVoidResult(NID_GRP, r == E_SUCCESS, r, "Propagating.");
-
EGLNativePixmapType nativePixmap = _CreateNativePixmap(pSglInfo->sglIndex, bitmap.get());
SysTryReturnVoidResult(NID_GRP, nativePixmap != (EGLNativePixmapType)0, E_OPERATION_FAILED, "Propagating.");
-
EGLSurface eglSurface = eglCreatePixmapSurface(pSglInfo->display, pSglInfo->config, nativePixmap, null);
SysTryReturnVoidResult(NID_GRP, eglSurface != EGL_NO_SURFACE, E_OPERATION_FAILED, "eglCreatePixmapSurface failed.");
pSglInfo->nativePixmap = nativePixmap;
pSglInfo->surface = eglSurface;
- pSglInfo->pObject = pObject;
- pSglInfo->pVisualElementSurface = pVisualElementSurface;
pSglInfo->isBackbuffer = true;
pSglInfo->wasShown = false;
pSglInfo->swapDone = false;
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.");
-
- evas_object_image_alpha_set(pObject, EINA_TRUE);
- evas_object_image_size_set(pObject, widthPhysical, heightPhysical);
- evas_object_resize(pObject, widthPhysical, heightPhysical);
- evas_object_hide(pObject);
-
- pVisualElementSurface = _VisualElementSurfaceImpl::CreateSurfaceUsingExistingObjectN(
- *pSglInfo->pWindow->GetDisplayContext(), (Handle)pObject, Dimension(width, height));
- SysTryReturnVoidResult(NID_GRP, pVisualElementSurface != null, E_OPERATION_FAILED, "Creating VisualElementSurface failed.");
+ evas_object_image_size_set(pSglInfoSecond->pObject, widthPhysical, heightPhysical);
+ evas_object_resize(pSglInfoSecond->pObject, widthPhysical, heightPhysical);
delete pSglInfoSecond->pBitmap;
pSglInfoSecond->pBitmap = null;
-
std::auto_ptr <Bitmap> bitmapSecond(new (std::nothrow) Bitmap);
SysTryReturnVoidResult(NID_GRP, bitmapSecond.get() != null, E_OUT_OF_MEMORY, "The memory is insufficient.");
-
r = bitmapSecond.get()->Construct(Rectangle(0, 0, width, height));
SysTryReturnVoidResult(NID_GRP, r == E_SUCCESS, r, "Propagating.");
-
EGLNativePixmapType nativePixmap = _CreateNativePixmap(pSglInfoSecond->sglIndex, bitmapSecond.get());
SysTryReturnVoidResult(NID_GRP, nativePixmap != (EGLNativePixmapType)0, E_OPERATION_FAILED, "Propagating.");
-
EGLSurface eglSurface = eglCreatePixmapSurface(pSglInfoSecond->display, pSglInfoSecond->config, nativePixmap, null);
SysTryReturnVoidResult(NID_GRP, eglSurface != EGL_NO_SURFACE, E_OPERATION_FAILED, "eglCreatePixmapSurface failed.");
pSglInfoSecond->nativePixmap = nativePixmap;
pSglInfoSecond->surface = eglSurface;
- pSglInfoSecond->pObject = pObject;
- pSglInfoSecond->pVisualElementSurface = pVisualElementSurface;
pSglInfoSecond->pBitmap = bitmapSecond.release();
pSglInfoSecond->isBackbuffer = true;
pSglInfoSecond->wasShown = false;
pSglInfoSecond->swapDone = true;
+
pSglInfo->isFirstSwap = true;
_EvasObjectImageChange(pSglInfoSecond);
}
- else
- {
- pSglInfo->pVisualElement->SetSurface(pVisualElementSurface);
- }
pSglInfo->pBitmap = bitmap.release();
_EvasObjectImageChange(pSglInfo);
- eglMakeCurrent(eglDisplay, drawSurface, readSurface, eglContext);
+ if (needSglMakeCurrent)
+ {
+ _SglMakeCurrent(eglDisplay, drawSurface, readSurface, eglContext);
+ }
+ else
+ {
+ eglMakeCurrent(eglDisplay, drawSurface, readSurface, eglContext);
+ }
return;
}