[Tizen] Implement partial update
[platform/core/uifw/dali-core.git] / dali / integration-api / core.cpp
1 /*
2  * Copyright (c) 2019 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                  ResourcePolicy::DataRetention policy,
44                  RenderToFrameBuffer renderToFboEnabled,
45                  DepthBufferAvailable depthBufferAvailable,
46                  StencilBufferAvailable stencilBufferAvailable,
47                  PartialUpdateAvailable partialUpdateAvailable )
48 {
49   Core* instance = new Core;
50   instance->mImpl = new Internal::Core( renderController,
51                                         platformAbstraction,
52                                         glAbstraction,
53                                         glSyncAbstraction,
54                                         glContextHelperAbstraction,
55                                         policy,
56                                         renderToFboEnabled,
57                                         depthBufferAvailable,
58                                         stencilBufferAvailable,
59                                         partialUpdateAvailable );
60
61   return instance;
62 }
63
64 Core::~Core()
65 {
66   delete mImpl;
67 }
68
69 void Core::Initialize()
70 {
71   mImpl->Initialize();
72 }
73
74 ContextNotifierInterface* Core::GetContextNotifier()
75 {
76   return mImpl->GetContextNotifier();
77 }
78
79 void Core::ContextCreated()
80 {
81   mImpl->ContextCreated();
82 }
83
84 void Core::ContextDestroyed()
85 {
86   mImpl->ContextDestroyed();
87 }
88
89 void Core::RecoverFromContextLoss()
90 {
91   mImpl->RecoverFromContextLoss();
92 }
93
94 void Core::SurfaceDeleted( Integration::RenderSurface* surface )
95 {
96   mImpl->SurfaceDeleted(surface);
97 }
98
99 void Core::SceneCreated()
100 {
101   mImpl->SceneCreated();
102 }
103
104 void Core::QueueEvent(const Event& event)
105 {
106   mImpl->QueueEvent(event);
107 }
108
109 void Core::ProcessEvents()
110 {
111   mImpl->ProcessEvents();
112 }
113
114 uint32_t Core::GetMaximumUpdateCount() const
115 {
116   return mImpl->GetMaximumUpdateCount();
117 }
118
119 void Core::Update( float elapsedSeconds, uint32_t lastVSyncTimeMilliseconds, uint32_t nextVSyncTimeMilliseconds, UpdateStatus& status, bool renderToFboEnabled, bool isRenderingToFbo )
120 {
121   mImpl->Update( elapsedSeconds, lastVSyncTimeMilliseconds, nextVSyncTimeMilliseconds, status, renderToFboEnabled, isRenderingToFbo );
122 }
123
124 void Core::Render( RenderStatus& status, bool forceClear, bool uploadOnly )
125 {
126   mImpl->Render( status, forceClear, uploadOnly );
127 }
128
129 void Core::RegisterProcessor( Processor& processor )
130 {
131   mImpl->RegisterProcessor( processor );
132 }
133
134 void Core::UnregisterProcessor( Processor& processor )
135 {
136   mImpl->UnregisterProcessor( processor );
137 }
138
139 Core::Core()
140 : mImpl( NULL )
141 {
142 }
143
144 } // namespace Integration
145
146 } // namespace Dali