Fixed pixmap issue
authorHeeJu Kang <mobum.kang@samsung.com>
Tue, 16 Apr 2013 13:16:24 +0000 (22:16 +0900)
committerHeeJu Kang <mobum.kang@samsung.com>
Tue, 16 Apr 2013 13:16:24 +0000 (22:16 +0900)
Change-Id: Ibe65a347a8c869bcdd589bc0b03ce9a900af6425
Signed-off-by: HeeJu Kang <mobum.kang@samsung.com>
src/FShell_AppWidgetPopupView.cpp
src/FShell_AppWidgetPopupView.h
src/FShell_AppWidgetPopupViewPresenter.cpp
src/FShell_AppWidgetView.cpp
src/FShell_AppWidgetView.h
src/FShell_AppWidgetViewPresenter.cpp

index 1837fc6..38a6d30 100644 (file)
@@ -30,6 +30,7 @@
 #include <FGrpRectangle.h>
 #include <FMediaImageTypes.h>
 #include <FSysSystemTime.h>
+#include <FUiAnimDisplayContext.h>
 #include <FUiAnimVisualElementAnimation.h>
 #include <FUiAnimVisualElementAnimationGroup.h>
 #include <FUiAnimVisualElementPropertyAnimation.h>
@@ -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<VisualElement, _VisualElementDeleter> 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());
index 59e8c1a..6a6c310 100644 (file)
@@ -154,6 +154,19 @@ private:
                }
        };
        std::unique_ptr<Ecore_Event_Handler, _EcoreEventHandlerDeleter> __pPixmapEventHandler;
+
+       struct _VisualElementDeleter
+       {
+           void operator()(Tizen::Ui::Animations::VisualElement* pVisualElement)
+           {
+            if (pVisualElement)
+            {
+                pVisualElement->Destroy();
+            }
+           }
+       };
+       std::unique_ptr<Tizen::Ui::Animations::VisualElement, _VisualElementDeleter> __pPixmapVisualElement;
+       std::unique_ptr<Tizen::Ui::Animations::VisualElementSurface> __pVisualElementSurface;
 }; // _AppWidgetPopupView
 
 }} // Tizen::Shell
index 25e5793..8366b11 100644 (file)
@@ -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.");
 
index acf0d4c..32551bc 100644 (file)
@@ -32,6 +32,7 @@
 #include <FGrpDimension.h>
 #include <FGrpPoint.h>
 #include <FGrpRectangle.h>
+#include <FUiAnimDisplayContext.h>
 #include <FUiAnimVisualElementPropertyAnimation.h>
 #include <FBase_StringConverter.h>
 #include <FGrp_BitmapImpl.h>
@@ -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<VisualElement, _VisualElementDeleter> 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();
 
index 45107ad..550ff1e 100644 (file)
@@ -176,6 +176,19 @@ private:
        };
        std::unique_ptr<Ecore_Event_Handler, _EcoreEventHandlerDeleter> __pPixmapEventHandler;
        std::unique_ptr<Tizen::Base::Collection::IListT<_IAppWidgetViewEventListener*> > __pAppWidgetViewEventListenerList;
+
+       struct _VisualElementDeleter
+       {
+           void operator()(Tizen::Ui::Animations::VisualElement* pVisualElement)
+           {
+            if (pVisualElement)
+            {
+                pVisualElement->Destroy();
+            }
+           }
+       };
+       std::unique_ptr<Tizen::Ui::Animations::VisualElement, _VisualElementDeleter> __pPixmapVisualElement;
+       std::unique_ptr<Tizen::Ui::Animations::VisualElementSurface> __pVisualElementSurface;
 }; // _AppWidgetView
 
 }} // Tizen::Shell
index d1aa011..7f6cda0 100644 (file)
@@ -114,12 +114,6 @@ _AppWidgetViewPresenter::GetAppIconPath(void) const
 void
 _AppWidgetViewPresenter::Draw(void)
 {
-/*
-       if (__pAppWidgetView->GetPixmapId() != -1)
-       {
-               return;
-       }
-*/
        Bitmap* pBitmap = __pAppWidgetView->GetBitmap();
        bool imageDone = false;