Partial update implementation, first phase.
[platform/core/uifw/dali-core.git] / dali / integration-api / core.cpp
1 /*
2  * Copyright (c) 2020 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/public-api/common/dali-common.h>
23 #include <dali/public-api/actors/layer.h>
24 #include <dali/public-api/render-tasks/render-task-list.h>
25 #include <dali/integration-api/events/event.h>
26 #include <dali/integration-api/gl-sync-abstraction.h>
27 #include <dali/integration-api/gl-context-helper-abstraction.h>
28 #include <dali/integration-api/processor-interface.h>
29 #include <dali/internal/common/core-impl.h>
30
31 namespace Dali
32 {
33
34 namespace Integration
35 {
36
37 Core* Core::New( RenderController& renderController,
38                  PlatformAbstraction& platformAbstraction,
39                  GlAbstraction& glAbstraction,
40                  GlSyncAbstraction& glSyncAbstraction,
41                  GlContextHelperAbstraction& glContextHelperAbstraction,
42                  RenderToFrameBuffer renderToFboEnabled,
43                  DepthBufferAvailable depthBufferAvailable,
44                  StencilBufferAvailable stencilBufferAvailable,
45                  PartialUpdateAvailable partialUpdateAvailable )
46 {
47   Core* instance = new Core;
48   instance->mImpl = new Internal::Core( renderController,
49                                         platformAbstraction,
50                                         glAbstraction,
51                                         glSyncAbstraction,
52                                         glContextHelperAbstraction,
53                                         renderToFboEnabled,
54                                         depthBufferAvailable,
55                                         stencilBufferAvailable,
56                                         partialUpdateAvailable );
57
58   return instance;
59 }
60
61 Core::~Core()
62 {
63   delete mImpl;
64 }
65
66 void Core::Initialize()
67 {
68   mImpl->Initialize();
69 }
70
71 ContextNotifierInterface* Core::GetContextNotifier()
72 {
73   return mImpl->GetContextNotifier();
74 }
75
76 void Core::ContextCreated()
77 {
78   mImpl->ContextCreated();
79 }
80
81 void Core::ContextDestroyed()
82 {
83   mImpl->ContextDestroyed();
84 }
85
86 void Core::RecoverFromContextLoss()
87 {
88   mImpl->RecoverFromContextLoss();
89 }
90
91 void Core::SceneCreated()
92 {
93   mImpl->SceneCreated();
94 }
95
96 void Core::QueueEvent(const Event& event)
97 {
98   mImpl->QueueEvent(event);
99 }
100
101 void Core::ProcessEvents()
102 {
103   mImpl->ProcessEvents();
104 }
105
106 uint32_t Core::GetMaximumUpdateCount() const
107 {
108   return mImpl->GetMaximumUpdateCount();
109 }
110
111 void Core::Update( float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo )
112 {
113   mImpl->Update( elapsedSeconds, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, status, renderToFboEnabled, isRenderingToFbo );
114 }
115
116 void Core::PreRender( RenderStatus& status, bool forceClear, bool uploadOnly )
117 {
118   mImpl->PreRender( status, forceClear, uploadOnly );
119 }
120
121 void Core::PreRender( Integration::Scene& scene, std::vector<Rect<int>>& damagedRects )
122 {
123   mImpl->PreRender( scene, damagedRects );
124 }
125
126 void Core::RenderScene( RenderStatus& status, Integration::Scene& scene, bool renderToFbo )
127 {
128   mImpl->RenderScene( status, scene, renderToFbo );
129 }
130
131 void Core::RenderScene( RenderStatus& status, Integration::Scene& scene, bool renderToFbo, Rect<int>& clippingRect )
132 {
133   mImpl->RenderScene( status, scene, renderToFbo, clippingRect );
134 }
135
136 void Core::PostRender( bool uploadOnly )
137 {
138   mImpl->PostRender( uploadOnly );
139 }
140
141 void Core::RegisterProcessor( Processor& processor )
142 {
143   mImpl->RegisterProcessor( processor );
144 }
145
146 void Core::UnregisterProcessor( Processor& processor )
147 {
148   mImpl->UnregisterProcessor( processor );
149 }
150
151 Core::Core()
152 : mImpl( NULL )
153 {
154 }
155
156 } // namespace Integration
157
158 } // namespace Dali