1 #ifndef DALI_INTERNAL_OFFSCREEN_WINDOW_IMPL_H
2 #define DALI_INTERNAL_OFFSCREEN_WINDOW_IMPL_H
5 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
23 #include <dali/public-api/common/intrusive-ptr.h>
24 #include <dali/public-api/signals/connection-tracker.h>
27 #include <dali/devel-api/adaptor-framework/offscreen-window.h>
28 #include <dali/integration-api/adaptor-framework/scene-holder-impl.h>
34 class NativeRenderSurface;
35 class TriggerEventInterface;
41 * Implementation of the OffscreenWindow class.
43 class OffscreenWindow : public Dali::Internal::Adaptor::SceneHolder,
44 public ConnectionTracker
47 using WindowSize = Dali::OffscreenWindow::WindowSize;
48 using PostRenderSignalType = Dali::OffscreenWindow::PostRenderSignalType;
51 * @brief Create a new OffscreenWindow
53 * @param[in] width The initial width of the OffscreenWindow
54 * @param[in] height The initial height of the OffscreenWindow
55 * @param[in] surface The native surface handle of your platform
56 * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
58 static OffscreenWindow* New( uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent );
60 OffscreenWindow() = default;
70 * @copydoc Dali::OffscreenWindow::GetLayerCount
72 uint32_t GetLayerCount() const;
75 * @copydoc Dali::OffscreenWindow::GetLayer
77 Dali::Layer GetLayer( uint32_t depth ) const;
80 * @copydoc Dali::OffscreenWindow::GetSize
82 WindowSize GetSize() const;
85 * @copydoc Dali::OffscreenWindow::GetNativeHandle
87 Any GetNativeHandle() const override;
90 * @brief Initialize the OffscreenWindow
91 * @param[in] isDefaultWindow Whether the OffscreenWindow is a default one or not
93 void Initialize( bool isDefaultWindow );
98 * @copydoc Dali::OffscreenWindow::PostRenderSignal
100 PostRenderSignalType& PostRenderSignal();
104 * This function is called after drawing by dali.
109 * @brief Get the native render surface
110 * @return The render surface
112 NativeRenderSurface* GetNativeRenderSurface() const;
117 * Private constructor
119 * @param[in] width The initial width of the OffscreenWindow
120 * @param[in] height The initial height of the OffscreenWindow
121 * @param[in] surface The native surface handle
122 * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
124 OffscreenWindow( uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent );
127 OffscreenWindow( const OffscreenWindow& );
128 OffscreenWindow& operator=( OffscreenWindow& );
131 * @brief Initialize the OffscreenWindow (for internal use)
137 std::unique_ptr< TriggerEventInterface > mRenderNotification;
138 PostRenderSignalType mPostRenderSignal;
141 inline OffscreenWindow& GetImplementation( Dali::OffscreenWindow& offscreenWindow )
143 DALI_ASSERT_ALWAYS( offscreenWindow && "Dali::OffscreenWindow handle is empty" );
145 BaseObject& handle = offscreenWindow.GetBaseObject();
147 return static_cast<OffscreenWindow&>( handle );
150 inline const OffscreenWindow& GetImplementation( const Dali::OffscreenWindow& offscreenWindow )
152 DALI_ASSERT_ALWAYS( offscreenWindow && "Dali::OffscreenWindow handle is empty" );
154 const BaseObject& handle = offscreenWindow.GetBaseObject();
156 return static_cast<const OffscreenWindow&>( handle );
159 } // namespace Internal
163 #endif // DALI_INTERNAL_OFFSCREEN_WINDOW_IMPL_H