Remove RenderSurface from Core
[platform/core/uifw/dali-core.git] / dali / internal / update / common / scene-graph-scene.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 // CLASS HEADER
18 #include <dali/internal/update/common/scene-graph-scene.h>
19
20 #include <dali/internal/update/render-tasks/scene-graph-render-task-list.h>
21
22 namespace Dali
23 {
24 namespace Internal
25 {
26 namespace SceneGraph
27 {
28
29 Scene::Scene()
30 : mContext( nullptr )
31 {
32 }
33
34 Scene::~Scene()
35 {
36   if ( mContext )
37   {
38     mContext->GlContextDestroyed();
39
40     delete mContext;
41     mContext = nullptr;
42   }
43 }
44
45 void Scene::GlContextDestroyed()
46 {
47   if ( mContext )
48   {
49     mContext->GlContextDestroyed();
50   }
51 }
52
53 void Scene::Initialize( Context& context )
54 {
55   if ( mContext != &context )
56   {
57     if ( mContext )
58     {
59       mContext->GlContextDestroyed();
60       delete mContext;
61     }
62
63     mContext = &context;
64     mContext->GlContextCreated();
65   }
66 }
67
68 Context* Scene::GetContext()
69 {
70   return mContext;
71 }
72
73 RenderInstructionContainer& Scene::GetRenderInstructions()
74 {
75   return mInstructions;
76 }
77
78 } //SceneGraph
79
80 } //Internal
81
82 } //Dali