Merge "Reducing Node struct size" into devel/master
[platform/core/uifw/dali-core.git] / dali / integration-api / core.cpp
1 /*
2  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/integration-api/core.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/integration-api/events/event.h>
23 #include <dali/integration-api/processor-interface.h>
24 #include <dali/internal/common/core-impl.h>
25 #include <dali/public-api/actors/layer.h>
26 #include <dali/public-api/common/dali-common.h>
27 #include <dali/public-api/render-tasks/render-task-list.h>
28
29 namespace Dali
30 {
31 namespace Integration
32 {
33 Core* Core::New(RenderController&      renderController,
34                 PlatformAbstraction&   platformAbstraction,
35                 Graphics::Controller&  graphicsController,
36                 RenderToFrameBuffer    renderToFboEnabled,
37                 DepthBufferAvailable   depthBufferAvailable,
38                 StencilBufferAvailable stencilBufferAvailable,
39                 PartialUpdateAvailable partialUpdateAvailable)
40 {
41   Core* instance  = new Core;
42   instance->mImpl = new Internal::Core(renderController,
43                                        platformAbstraction,
44                                        graphicsController,
45                                        renderToFboEnabled,
46                                        depthBufferAvailable,
47                                        stencilBufferAvailable,
48                                        partialUpdateAvailable);
49
50   return instance;
51 }
52
53 Core::~Core()
54 {
55   delete mImpl;
56 }
57
58 void Core::Initialize()
59 {
60   mImpl->Initialize();
61 }
62
63 ContextNotifierInterface* Core::GetContextNotifier()
64 {
65   return mImpl->GetContextNotifier();
66 }
67
68 void Core::ContextCreated()
69 {
70   mImpl->ContextCreated();
71 }
72
73 void Core::ContextDestroyed()
74 {
75   mImpl->ContextDestroyed();
76 }
77
78 void Core::RecoverFromContextLoss()
79 {
80   mImpl->RecoverFromContextLoss();
81 }
82
83 void Core::SceneCreated()
84 {
85   mImpl->SceneCreated();
86 }
87
88 void Core::QueueEvent(const Event& event)
89 {
90   mImpl->QueueEvent(event);
91 }
92
93 void Core::ProcessEvents()
94 {
95   mImpl->ProcessEvents();
96 }
97
98 uint32_t Core::GetMaximumUpdateCount() const
99 {
100   return mImpl->GetMaximumUpdateCount();
101 }
102
103 void Core::Update(float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo, bool uploadOnly)
104 {
105   mImpl->Update(elapsedSeconds, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, status, renderToFboEnabled, isRenderingToFbo, uploadOnly);
106 }
107
108 void Core::PreRender(RenderStatus& status, bool forceClear)
109 {
110   mImpl->PreRender(status, forceClear);
111 }
112
113 void Core::PreRender(Integration::Scene& scene, std::vector<Rect<int>>& damagedRects)
114 {
115   mImpl->PreRender(scene, damagedRects);
116 }
117
118 void Core::RenderScene(RenderStatus& status, Integration::Scene& scene, bool renderToFbo)
119 {
120   mImpl->RenderScene(status, scene, renderToFbo);
121 }
122
123 void Core::RenderScene(RenderStatus& status, Integration::Scene& scene, bool renderToFbo, Rect<int>& clippingRect)
124 {
125   mImpl->RenderScene(status, scene, renderToFbo, clippingRect);
126 }
127
128 void Core::PostRender()
129 {
130   mImpl->PostRender();
131 }
132
133 void Core::RegisterProcessor(Processor& processor, bool postProcessor)
134 {
135   mImpl->RegisterProcessor(processor, postProcessor);
136 }
137
138 void Core::UnregisterProcessor(Processor& processor, bool postProcessor)
139 {
140   mImpl->UnregisterProcessor(processor, postProcessor);
141 }
142
143 ObjectRegistry Core::GetObjectRegistry() const
144 {
145   return ObjectRegistry(&mImpl->GetObjectRegistry());
146 }
147
148 Core::Core()
149 : mImpl(nullptr)
150 {
151 }
152
153 } // namespace Integration
154
155 } // namespace Dali