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>
21 #include <dali/internal/update/render-tasks/scene-graph-render-task-list.h>
22 #include <dali/internal/render/gl-resources/context.h>
32 : mContext( nullptr ),
33 mFrameRenderedCallbacks(),
34 mFramePresentedCallbacks(),
35 mSkipRendering( false ),
37 mSurfaceOrientation( 0 ),
38 mSurfaceRectChanged( false )
44 mFrameRenderedCallbacks.clear();
45 mFramePresentedCallbacks.clear();
48 void Scene::Initialize( Context& context )
53 Context* Scene::GetContext()
58 RenderInstructionContainer& Scene::GetRenderInstructions()
63 void Scene::AddFrameRenderedCallback( CallbackBase* callback, int32_t frameId )
65 mFrameRenderedCallbacks.push_back( std::make_pair( std::unique_ptr< CallbackBase >( callback ), frameId ) );
68 void Scene::AddFramePresentedCallback( CallbackBase* callback, int32_t frameId )
70 mFramePresentedCallbacks.push_back( std::make_pair( std::unique_ptr< CallbackBase >( callback ), frameId ) );
73 void Scene::GetFrameRenderedCallback( Dali::Integration::Scene::FrameCallbackContainer& callbacks )
75 // Transfer owership of the callbacks
76 for( auto&& iter : mFrameRenderedCallbacks )
78 callbacks.push_back( std::make_pair( std::move( iter.first ), iter.second ) );
81 mFrameRenderedCallbacks.clear();
84 void Scene::GetFramePresentedCallback( Dali::Integration::Scene::FrameCallbackContainer& callbacks )
86 // Transfer owership of the callbacks
87 for( auto&& iter : mFramePresentedCallbacks )
89 callbacks.push_back( std::make_pair( std::move( iter.first ), iter.second ) );
92 mFramePresentedCallbacks.clear();
95 void Scene::SetSkipRendering( bool skip )
97 mSkipRendering = skip;
100 bool Scene::IsRenderingSkipped() const
102 return mSkipRendering;
105 void Scene::SetSurfaceRect( const Rect<int32_t>& rect )
108 mSurfaceRectChanged = true;
111 const Rect<int32_t>& Scene::GetSurfaceRect() const
116 void Scene::SetSurfaceOrientation( int32_t orientation )
118 mSurfaceOrientation = orientation;
121 int32_t Scene::GetSurfaceOrientation() const
123 return mSurfaceOrientation;
126 bool Scene::IsSurfaceRectChanged()
128 bool surfaceRectChanged = mSurfaceRectChanged;
129 mSurfaceRectChanged = false;
131 return surfaceRectChanged;