[dali_1.5.0] Merge branch 'devel/master'
[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 #include <dali/integration-api/render-surface.h>
21
22 // INTERNAL INCLUDES
23 #include <dali/public-api/common/dali-common.h>
24 #include <dali/public-api/actors/layer.h>
25 #include <dali/public-api/render-tasks/render-task-list.h>
26 #include <dali/integration-api/events/event.h>
27 #include <dali/integration-api/gl-sync-abstraction.h>
28 #include <dali/integration-api/gl-context-helper-abstraction.h>
29 #include <dali/integration-api/processor-interface.h>
30 #include <dali/internal/common/core-impl.h>
31
32 namespace Dali
33 {
34
35 namespace Integration
36 {
37
38 Core* Core::New( RenderController& renderController,
39                  PlatformAbstraction& platformAbstraction,
40                  GlAbstraction& glAbstraction,
41                  GlSyncAbstraction& glSyncAbstraction,
42                  GlContextHelperAbstraction& glContextHelperAbstraction,
43                  RenderToFrameBuffer renderToFboEnabled,
44                  DepthBufferAvailable depthBufferAvailable,
45                  StencilBufferAvailable stencilBufferAvailable )
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
57   return instance;
58 }
59
60 Core::~Core()
61 {
62   delete mImpl;
63 }
64
65 void Core::Initialize()
66 {
67   mImpl->Initialize();
68 }
69
70 ContextNotifierInterface* Core::GetContextNotifier()
71 {
72   return mImpl->GetContextNotifier();
73 }
74
75 void Core::ContextCreated()
76 {
77   mImpl->ContextCreated();
78 }
79
80 void Core::ContextDestroyed()
81 {
82   mImpl->ContextDestroyed();
83 }
84
85 void Core::RecoverFromContextLoss()
86 {
87   mImpl->RecoverFromContextLoss();
88 }
89
90 void Core::SurfaceDeleted( Integration::RenderSurface* surface )
91 {
92   mImpl->SurfaceDeleted(surface);
93 }
94
95 void Core::SceneCreated()
96 {
97   mImpl->SceneCreated();
98 }
99
100 void Core::QueueEvent(const Event& event)
101 {
102   mImpl->QueueEvent(event);
103 }
104
105 void Core::ProcessEvents()
106 {
107   mImpl->ProcessEvents();
108 }
109
110 uint32_t Core::GetMaximumUpdateCount() const
111 {
112   return mImpl->GetMaximumUpdateCount();
113 }
114
115 void Core::Update( float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo )
116 {
117   mImpl->Update( elapsedSeconds, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, status, renderToFboEnabled, isRenderingToFbo );
118 }
119
120 void Core::Render( RenderStatus& status, bool forceClear, bool uploadOnly )
121 {
122   mImpl->Render( status, forceClear, uploadOnly );
123 }
124
125 void Core::RegisterProcessor( Processor& processor )
126 {
127   mImpl->RegisterProcessor( processor );
128 }
129
130 void Core::UnregisterProcessor( Processor& processor )
131 {
132   mImpl->UnregisterProcessor( processor );
133 }
134
135 Core::Core()
136 : mImpl( NULL )
137 {
138 }
139
140 } // namespace Integration
141
142 } // namespace Dali