From: SooChan Lim Date: Wed, 29 Jul 2020 01:14:16 +0000 (+0900) Subject: DSCanvas: add registerCallbackWindowCreated and make renderView X-Git-Tag: accepted/tizen/unified/20200820.213435~195 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F80%2F241680%2F1;p=platform%2Fcore%2Fuifw%2Flibds.git DSCanvas: add registerCallbackWindowCreated and make renderView DSCanvas makes DSRenderView when DSZone creates the DSWindow. Change-Id: Ia9e180b26b45457a8e6c0fd58bbee9353ec534ec --- diff --git a/src/DSCanvas/DSCanvas.cpp b/src/DSCanvas/DSCanvas.cpp index c200df4..7be8291 100644 --- a/src/DSCanvas/DSCanvas.cpp +++ b/src/DSCanvas/DSCanvas.cpp @@ -53,6 +53,7 @@ bool DSCanvasPrivate::attachPolicyArea(std::shared_ptr policyArea) } __zone = std::make_shared(policyArea); + __zone->registerCallbackWindowCreated(this, std::bind(&DSCanvasPrivate::__onWindowCreated, this, std::placeholders::_1)); return true; } @@ -88,4 +89,9 @@ bool DSCanvasPrivate::attachDisplayArea(std::shared_ptr displayAr return true; } +void DSCanvasPrivate::__onWindowCreated(std::shared_ptr window) +{ + std::shared_ptr renderView = __RenderEngine->makeRenderView(window); +} + } // namespace display_server diff --git a/src/DSCanvas/DSCanvasPrivate.h b/src/DSCanvas/DSCanvasPrivate.h index 2688f0a..fb98032 100644 --- a/src/DSCanvas/DSCanvasPrivate.h +++ b/src/DSCanvas/DSCanvasPrivate.h @@ -8,7 +8,7 @@ namespace display_server { -class DSCanvasPrivate : public DSObjectPrivate +class DSCanvasPrivate : public DSObjectPrivate, public DSObject { DS_PIMPL_USE_PUBLIC(DSCanvas); public: @@ -21,6 +21,8 @@ public: bool attachDisplayArea(std::shared_ptr displayArea); private: + void __onWindowCreated(std::shared_ptr window); + std::shared_ptr __zone; std::shared_ptr __displayArea; std::shared_ptr __RenderEngine; diff --git a/src/DSRender/DSRenderEngineDaliImpl.cpp b/src/DSRender/DSRenderEngineDaliImpl.cpp index 3bf7990..02245a6 100644 --- a/src/DSRender/DSRenderEngineDaliImpl.cpp +++ b/src/DSRender/DSRenderEngineDaliImpl.cpp @@ -12,9 +12,9 @@ DSRenderEngineDaliImpl::DSRenderEngineDaliImpl(std::shared_ptr b DSRenderEngineDaliImpl::~DSRenderEngineDaliImpl() {} -std::shared_ptr DSRenderEngineDaliImpl::makeRenderView() +std::shared_ptr DSRenderEngineDaliImpl::makeRenderView(std::shared_ptr window) { - std::shared_ptr renderView = std::make_shared(); + std::shared_ptr renderView = std::make_shared(window); return renderView; } diff --git a/src/DSRender/DSRenderEngineDaliImpl.h b/src/DSRender/DSRenderEngineDaliImpl.h index d50ac49..2b101e1 100644 --- a/src/DSRender/DSRenderEngineDaliImpl.h +++ b/src/DSRender/DSRenderEngineDaliImpl.h @@ -13,7 +13,7 @@ public: DSRenderEngineDaliImpl(std::shared_ptr bufferQueue); ~DSRenderEngineDaliImpl(); - std::shared_ptr makeRenderView() override; + std::shared_ptr makeRenderView(std::shared_ptr window) override; bool renderFrame() override; private: diff --git a/src/DSRender/DSRenderEngineEcoreEvasImpl.cpp b/src/DSRender/DSRenderEngineEcoreEvasImpl.cpp index 82bf8d1..c211ad5 100644 --- a/src/DSRender/DSRenderEngineEcoreEvasImpl.cpp +++ b/src/DSRender/DSRenderEngineEcoreEvasImpl.cpp @@ -44,9 +44,9 @@ DSRenderEngineEcoreEvasImpl::~DSRenderEngineEcoreEvasImpl() evas_shutdown(); } -std::shared_ptr DSRenderEngineEcoreEvasImpl::makeRenderView() +std::shared_ptr DSRenderEngineEcoreEvasImpl::makeRenderView(std::shared_ptr window) { - std::shared_ptr renderView = std::make_shared(__ee); + std::shared_ptr renderView = std::make_shared(__ee, window); return renderView; } diff --git a/src/DSRender/DSRenderEngineEcoreEvasImpl.h b/src/DSRender/DSRenderEngineEcoreEvasImpl.h index 163c7f2..5e9e696 100644 --- a/src/DSRender/DSRenderEngineEcoreEvasImpl.h +++ b/src/DSRender/DSRenderEngineEcoreEvasImpl.h @@ -14,7 +14,7 @@ public: DSRenderEngineEcoreEvasImpl(std::shared_ptr bufferQueue); ~DSRenderEngineEcoreEvasImpl(); - std::shared_ptr makeRenderView() override; + std::shared_ptr makeRenderView(std::shared_ptr window) override; bool renderFrame() override; private: diff --git a/src/DSRender/DSRenderView.h b/src/DSRender/DSRenderView.h index a76eaa2..d7b2e88 100644 --- a/src/DSRender/DSRenderView.h +++ b/src/DSRender/DSRenderView.h @@ -1,7 +1,8 @@ -#ifndef __DS_RENDER_VIEW_H_ -#define __DS_RENDER_VIEW_H_ +#ifndef __DS_RENDER_VIEW_H__ +#define __DS_RENDER_VIEW_H__ #include "IDSBuffer.h" +#include "DSWindow.h" #include namespace display_server diff --git a/src/DSRender/DSRenderViewDaliImpl.cpp b/src/DSRender/DSRenderViewDaliImpl.cpp index 5b83e3a..685fd48 100644 --- a/src/DSRender/DSRenderViewDaliImpl.cpp +++ b/src/DSRender/DSRenderViewDaliImpl.cpp @@ -3,7 +3,8 @@ namespace display_server { -DSRenderViewDaliImpl::DSRenderViewDaliImpl() +DSRenderViewDaliImpl::DSRenderViewDaliImpl(std::shared_ptr window) + : __window(window) {} DSRenderViewDaliImpl::~DSRenderViewDaliImpl() diff --git a/src/DSRender/DSRenderViewDaliImpl.h b/src/DSRender/DSRenderViewDaliImpl.h index 36990f1..d66b59f 100644 --- a/src/DSRender/DSRenderViewDaliImpl.h +++ b/src/DSRender/DSRenderViewDaliImpl.h @@ -9,13 +9,13 @@ namespace display_server class DSRenderViewDaliImpl : public DSRenderView { public: - DSRenderViewDaliImpl(); + DSRenderViewDaliImpl(std::shared_ptr window); ~DSRenderViewDaliImpl(); bool setBuffer(std::shared_ptr buffer) override; private: - /* data */ + std::shared_ptr __window; }; } diff --git a/src/DSRender/DSRenderViewEcoreEvasImpl.cpp b/src/DSRender/DSRenderViewEcoreEvasImpl.cpp index 8ce49be..15147e2 100644 --- a/src/DSRender/DSRenderViewEcoreEvasImpl.cpp +++ b/src/DSRender/DSRenderViewEcoreEvasImpl.cpp @@ -4,7 +4,8 @@ namespace display_server { -DSRenderViewEcoreEvasImpl::DSRenderViewEcoreEvasImpl(Ecore_Evas *ee) +DSRenderViewEcoreEvasImpl::DSRenderViewEcoreEvasImpl(Ecore_Evas *ee, std::shared_ptr window) + : __window(window) { __evasView = evas_object_image_filled_add(ecore_evas_get(ee)); evas_object_image_border_center_fill_set(__evasView, EVAS_BORDER_FILL_SOLID); diff --git a/src/DSRender/DSRenderViewEcoreEvasImpl.h b/src/DSRender/DSRenderViewEcoreEvasImpl.h index eca50a7..e82f54c 100644 --- a/src/DSRender/DSRenderViewEcoreEvasImpl.h +++ b/src/DSRender/DSRenderViewEcoreEvasImpl.h @@ -10,13 +10,14 @@ namespace display_server class DSRenderViewEcoreEvasImpl : public DSRenderView { public: - DSRenderViewEcoreEvasImpl(Ecore_Evas *ee); + DSRenderViewEcoreEvasImpl(Ecore_Evas *ee, std::shared_ptr window); ~DSRenderViewEcoreEvasImpl(); bool setBuffer(std::shared_ptr buffer) override; private: Evas_Object *__evasView; + std::shared_ptr __window; }; diff --git a/src/DSRender/IDSRenderEngine.h b/src/DSRender/IDSRenderEngine.h index 17d32cc..02f906d 100644 --- a/src/DSRender/IDSRenderEngine.h +++ b/src/DSRender/IDSRenderEngine.h @@ -2,6 +2,7 @@ #define __I_DS_RENDER_ENGINE_H_ #include "DSRenderView.h" +#include "DSWindow.h" #include namespace display_server @@ -12,7 +13,7 @@ class IDSRenderEngine public: virtual ~IDSRenderEngine() = default; - virtual std::shared_ptr makeRenderView() = 0; + virtual std::shared_ptr makeRenderView(std::shared_ptr window) = 0; virtual bool renderFrame() = 0; }; diff --git a/tests/DSRenderEngineDaliImpl-test.cpp b/tests/DSRenderEngineDaliImpl-test.cpp index 2dca108..daca8a1 100644 --- a/tests/DSRenderEngineDaliImpl-test.cpp +++ b/tests/DSRenderEngineDaliImpl-test.cpp @@ -17,36 +17,34 @@ public: TEST_F(DSRenderEngineDaliTest, RenderEngine_Create) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); } TEST_F(DSRenderEngineDaliTest, RenderEngine_CreateRenderView) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); - - std::shared_ptr renderView = renderEngine->makeRenderView(); + auto window = std::make_shared(); + EXPECT_TRUE(window != nullptr); + auto renderView = renderEngine->makeRenderView(window); EXPECT_TRUE(renderView != nullptr); } TEST_F(DSRenderEngineDaliTest, RenderView_SetBuffer) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); - - std::shared_ptr renderView = renderEngine->makeRenderView(); + auto window = std::make_shared(); + EXPECT_TRUE(window != nullptr); + auto renderView = renderEngine->makeRenderView(window); EXPECT_TRUE(renderView != nullptr); - - std::shared_ptr buffer = std::make_shared(100, 100, IDSBuffer::FORMAT_ARGB8888); + auto buffer = std::make_shared(100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(renderView->setBuffer(buffer)); } \ No newline at end of file diff --git a/tests/DSRenderEngineEcoreEvasImpl-test.cpp b/tests/DSRenderEngineEcoreEvasImpl-test.cpp index 6f04055..27db52f 100644 --- a/tests/DSRenderEngineEcoreEvasImpl-test.cpp +++ b/tests/DSRenderEngineEcoreEvasImpl-test.cpp @@ -16,43 +16,49 @@ public: TEST_F(DSRenderEngineEcoreEvasTest, RenderEngine_Create) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); } TEST_F(DSRenderEngineEcoreEvasTest, RenderEngine_MakeRenderView) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); - std::shared_ptr renderView = renderEngine->makeRenderView(); + auto window = std::make_shared(); + EXPECT_TRUE(window != nullptr); + auto renderView = renderEngine->makeRenderView(window); EXPECT_TRUE(renderView != nullptr); } TEST_F(DSRenderEngineEcoreEvasTest, RenderView_SetBuffer) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); - std::shared_ptr renderView = renderEngine->makeRenderView(); + auto window = std::make_shared(); + EXPECT_TRUE(window != nullptr); + auto renderView = renderEngine->makeRenderView(window); EXPECT_TRUE(renderView != nullptr); - std::shared_ptr buffer = std::make_shared (100, 100, IDSBuffer::FORMAT_ARGB8888); + auto buffer = std::make_shared (100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(renderView->setBuffer(buffer)); } TEST_F(DSRenderEngineEcoreEvasTest, RenderEngine_RenderFrame) { - std::shared_ptr bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); + auto bufferQueue = std::make_shared(3, 100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(bufferQueue != nullptr); - std::unique_ptr renderEngine = std::make_unique(bufferQueue); + auto renderEngine = std::make_unique(bufferQueue); EXPECT_TRUE(renderEngine != nullptr); - std::shared_ptr renderView = renderEngine->makeRenderView(); + auto window = std::make_shared(); + EXPECT_TRUE(window != nullptr); + auto renderView = renderEngine->makeRenderView(window); EXPECT_TRUE(renderView != nullptr); - std::shared_ptr buffer = std::make_shared (100, 100, IDSBuffer::FORMAT_ARGB8888); + auto buffer = std::make_shared (100, 100, IDSBuffer::FORMAT_ARGB8888); EXPECT_TRUE(renderView->setBuffer(buffer)); EXPECT_TRUE(renderEngine->renderFrame()); }