2 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
18 #include <dali/internal/update/common/scene-graph-scene.h>
20 #include <dali/internal/update/render-tasks/scene-graph-render-task-list.h>
30 : mContext( nullptr ),
31 mFrameRenderedCallbacks(),
32 mFramePresentedCallbacks()
40 mContext->GlContextDestroyed();
46 mFrameRenderedCallbacks.clear();
47 mFramePresentedCallbacks.clear();
50 void Scene::GlContextDestroyed()
54 mContext->GlContextDestroyed();
58 void Scene::Initialize( Context& context )
60 if ( mContext != &context )
64 mContext->GlContextDestroyed();
69 mContext->GlContextCreated();
73 Context* Scene::GetContext()
78 RenderInstructionContainer& Scene::GetRenderInstructions()
83 void Scene::AddFrameRenderedCallback( CallbackBase* callback, int32_t frameId )
85 mFrameRenderedCallbacks.push_back( std::make_pair( std::unique_ptr< CallbackBase >( callback ), frameId ) );
88 void Scene::AddFramePresentedCallback( CallbackBase* callback, int32_t frameId )
90 mFramePresentedCallbacks.push_back( std::make_pair( std::unique_ptr< CallbackBase >( callback ), frameId ) );
93 void Scene::GetFrameRenderedCallback( Dali::Integration::Scene::FrameCallbackContainer& callbacks )
95 // Transfer owership of the callbacks
96 for( auto&& iter : mFrameRenderedCallbacks )
98 callbacks.push_back( std::make_pair( std::move( iter.first ), iter.second ) );
101 mFrameRenderedCallbacks.clear();
104 void Scene::GetFramePresentedCallback( Dali::Integration::Scene::FrameCallbackContainer& callbacks )
106 // Transfer owership of the callbacks
107 for( auto&& iter : mFramePresentedCallbacks )
109 callbacks.push_back( std::make_pair( std::move( iter.first ), iter.second ) );
112 mFramePresentedCallbacks.clear();