From cc85e4915299a60a07079c8db36b68e442d063b3 Mon Sep 17 00:00:00 2001 From: HeeJu Kang Date: Tue, 16 Apr 2013 22:16:24 +0900 Subject: [PATCH] Fixed pixmap issue Change-Id: Ibe65a347a8c869bcdd589bc0b03ce9a900af6425 Signed-off-by: HeeJu Kang --- src/FShell_AppWidgetPopupView.cpp | 27 ++++++++++++++++++++++++--- src/FShell_AppWidgetPopupView.h | 13 +++++++++++++ src/FShell_AppWidgetPopupViewPresenter.cpp | 6 ------ src/FShell_AppWidgetView.cpp | 26 ++++++++++++++++++++++++-- src/FShell_AppWidgetView.h | 13 +++++++++++++ src/FShell_AppWidgetViewPresenter.cpp | 6 ------ 6 files changed, 74 insertions(+), 17 deletions(-) diff --git a/src/FShell_AppWidgetPopupView.cpp b/src/FShell_AppWidgetPopupView.cpp index 1837fc6..38a6d30 100644 --- a/src/FShell_AppWidgetPopupView.cpp +++ b/src/FShell_AppWidgetPopupView.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include @@ -492,7 +493,6 @@ _AppWidgetPopupView::OnAppWidgetUpdated(int pixmap) if (__pixmap != pixmap ) { _VisualElement* pVisualElement = GetVisualElement(); -// _VisualElement* pVisualElement = __pAppWidgetView->GetVisualElement(); SysTryReturnVoidResult(NID_SHELL, pVisualElement, E_SYSTEM, "[E_SYSTEM] A system error occurred."); _EflNode* pEflNode = dynamic_cast<_EflNode*>(pVisualElement->GetNativeNode()); @@ -507,12 +507,33 @@ _AppWidgetPopupView::OnAppWidgetUpdated(int pixmap) __pPixmapObject.reset(evas_object_image_filled_add(pEvas)); SysTryReturnVoidResult(NID_SHELL, __pPixmapObject.get(), E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient."); - pEflNode->AddNativeSmartObject(*pVisualElement, __pPixmapObject.get()); + _Window* pWindow = GetRootWindow(); + SysTryReturnVoidResult(NID_SHELL, pWindow, E_SYSTEM, "[E_SYSTEM] A system error occurred."); + + DisplayContext* pDisplayContext = pWindow->GetDisplayContext(); + SysTryReturnVoidResult(NID_SHELL, pDisplayContext, E_SYSTEM, "[E_SYSTEM] A system error occurred."); + + __pVisualElementSurface.reset(_VisualElementSurfaceImpl::CreateSurfaceUsingExistingObjectN(*pDisplayContext, (Handle)__pPixmapObject.get(), Dimension(width, height))); + SysTryReturnVoidResult(NID_SHELL, __pVisualElementSurface, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient."); + + unique_ptr pPixmapVisualElement(new (std::nothrow) VisualElement); + SysTryReturnVoidResult(NID_SHELL, pPixmapVisualElement, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient."); + + result r = pPixmapVisualElement->Construct(); + SysTryReturnVoidResult(NID_SHELL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); + + __pPixmapVisualElement = move(pPixmapVisualElement); + __pPixmapVisualElement->SetImplicitAnimationEnabled(false); + + pVisualElement->AttachChild(__pPixmapVisualElement.get()); + + __pPixmapVisualElement->SetBounds(FloatRectangle(0.0f, 0.0f, width, height)); + __pPixmapVisualElement->SetSurface(__pVisualElementSurface.get()); + __pPixmapVisualElement->SetShowState(true); evas_object_image_size_set(__pPixmapObject.get(), width, height); evas_object_image_colorspace_set(__pPixmapObject.get(), EVAS_COLORSPACE_ARGB8888); evas_object_image_alpha_set(__pPixmapObject.get(), EINA_TRUE); - evas_object_raise(__pPixmapObject.get()); evas_object_move(__pPixmapObject.get(), 0, 0); evas_object_show(__pPixmapObject.get()); diff --git a/src/FShell_AppWidgetPopupView.h b/src/FShell_AppWidgetPopupView.h index 59e8c1a..6a6c310 100644 --- a/src/FShell_AppWidgetPopupView.h +++ b/src/FShell_AppWidgetPopupView.h @@ -154,6 +154,19 @@ private: } }; std::unique_ptr __pPixmapEventHandler; + + struct _VisualElementDeleter + { + void operator()(Tizen::Ui::Animations::VisualElement* pVisualElement) + { + if (pVisualElement) + { + pVisualElement->Destroy(); + } + } + }; + std::unique_ptr __pPixmapVisualElement; + std::unique_ptr __pVisualElementSurface; }; // _AppWidgetPopupView }} // Tizen::Shell diff --git a/src/FShell_AppWidgetPopupViewPresenter.cpp b/src/FShell_AppWidgetPopupViewPresenter.cpp index 25e5793..8366b11 100644 --- a/src/FShell_AppWidgetPopupViewPresenter.cpp +++ b/src/FShell_AppWidgetPopupViewPresenter.cpp @@ -45,12 +45,6 @@ _AppWidgetPopupViewPresenter::~_AppWidgetPopupViewPresenter(void) void _AppWidgetPopupViewPresenter::Draw(void) { -/* - if (__pAppWidgetPopupView->GetPixmapId() != -1) - { - return; - } -*/ Bitmap* pBitmap = __pAppWidgetPopupView->GetBitmap(); SysTryReturnVoidResult(NID_SHELL, pBitmap, E_SYSTEM, "Bitmap is invalid."); diff --git a/src/FShell_AppWidgetView.cpp b/src/FShell_AppWidgetView.cpp index acf0d4c..32551bc 100644 --- a/src/FShell_AppWidgetView.cpp +++ b/src/FShell_AppWidgetView.cpp @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -667,12 +668,33 @@ _AppWidgetView::OnAppWidgetUpdated(int pixmap) __pPixmapObject.reset(evas_object_image_filled_add(pEvas)); SysTryReturnVoidResult(NID_SHELL, __pPixmapObject, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient."); - pEflNode->AddNativeSmartObject(*pVisualElement, __pPixmapObject.get()); + _Window* pWindow = GetRootWindow(); + SysTryReturnVoidResult(NID_SHELL, pWindow, E_SYSTEM, "[E_SYSTEM] A system error occurred."); + + DisplayContext* pDisplayContext = pWindow->GetDisplayContext(); + SysTryReturnVoidResult(NID_SHELL, pDisplayContext, E_SYSTEM, "[E_SYSTEM] A system error occurred."); + + __pVisualElementSurface.reset(_VisualElementSurfaceImpl::CreateSurfaceUsingExistingObjectN(*pDisplayContext, (Handle)__pPixmapObject.get(), Dimension(width, height))); + SysTryReturnVoidResult(NID_SHELL, __pVisualElementSurface, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient."); + + unique_ptr pPixmapVisualElement(new (std::nothrow) VisualElement); + SysTryReturnVoidResult(NID_SHELL, pPixmapVisualElement, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient."); + + result r = pPixmapVisualElement->Construct(); + SysTryReturnVoidResult(NID_SHELL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); + + __pPixmapVisualElement = move(pPixmapVisualElement); + __pPixmapVisualElement->SetImplicitAnimationEnabled(false); + + pVisualElement->AttachChild(__pPixmapVisualElement.get()); + + __pPixmapVisualElement->SetBounds(FloatRectangle(0.0f, 0.0f, width, height)); + __pPixmapVisualElement->SetSurface(__pVisualElementSurface.get()); + __pPixmapVisualElement->SetShowState(true); evas_object_image_size_set(__pPixmapObject.get(), width, height); evas_object_image_colorspace_set(__pPixmapObject.get(), EVAS_COLORSPACE_ARGB8888); evas_object_image_alpha_set(__pPixmapObject.get(), EINA_TRUE); - evas_object_raise(__pPixmapObject.get()); FloatRectangle absoluteBounds = GetAbsoluteBoundsF(); diff --git a/src/FShell_AppWidgetView.h b/src/FShell_AppWidgetView.h index 45107ad..550ff1e 100644 --- a/src/FShell_AppWidgetView.h +++ b/src/FShell_AppWidgetView.h @@ -176,6 +176,19 @@ private: }; std::unique_ptr __pPixmapEventHandler; std::unique_ptr > __pAppWidgetViewEventListenerList; + + struct _VisualElementDeleter + { + void operator()(Tizen::Ui::Animations::VisualElement* pVisualElement) + { + if (pVisualElement) + { + pVisualElement->Destroy(); + } + } + }; + std::unique_ptr __pPixmapVisualElement; + std::unique_ptr __pVisualElementSurface; }; // _AppWidgetView }} // Tizen::Shell diff --git a/src/FShell_AppWidgetViewPresenter.cpp b/src/FShell_AppWidgetViewPresenter.cpp index d1aa011..7f6cda0 100644 --- a/src/FShell_AppWidgetViewPresenter.cpp +++ b/src/FShell_AppWidgetViewPresenter.cpp @@ -114,12 +114,6 @@ _AppWidgetViewPresenter::GetAppIconPath(void) const void _AppWidgetViewPresenter::Draw(void) { -/* - if (__pAppWidgetView->GetPixmapId() != -1) - { - return; - } -*/ Bitmap* pBitmap = __pAppWidgetView->GetBitmap(); bool imageDone = false; -- 2.7.4