1 #ifndef DALI_INTERNAL_OFFSCREEN_WINDOW_IMPL_H
2 #define DALI_INTERNAL_OFFSCREEN_WINDOW_IMPL_H
5 * Copyright (c) 2021 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.
22 #include <dali/public-api/common/intrusive-ptr.h>
23 #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;
40 * Implementation of the OffscreenWindow class.
42 class OffscreenWindow : public Dali::Internal::Adaptor::SceneHolder,
43 public ConnectionTracker
46 using WindowSize = Dali::OffscreenWindow::WindowSize;
47 using PostRenderSignalType = Dali::OffscreenWindow::PostRenderSignalType;
50 * @brief Create a new OffscreenWindow
52 * @param[in] width The initial width of the OffscreenWindow
53 * @param[in] height The initial height of the OffscreenWindow
54 * @param[in] surface The native surface handle of your platform
55 * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
57 static OffscreenWindow* New(uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent);
59 OffscreenWindow() = default;
68 * @copydoc Dali::OffscreenWindow::GetLayerCount
70 uint32_t GetLayerCount() const;
73 * @copydoc Dali::OffscreenWindow::GetLayer
75 Dali::Layer GetLayer(uint32_t depth) const;
78 * @copydoc Dali::OffscreenWindow::GetSize
80 WindowSize GetSize() const;
83 * @copydoc Dali::OffscreenWindow::GetNativeHandle
85 Any GetNativeHandle() const override;
88 * @brief Initialize the OffscreenWindow
89 * @param[in] isDefaultWindow Whether the OffscreenWindow is a default one or not
91 void Initialize(bool isDefaultWindow);
95 * @copydoc Dali::OffscreenWindow::PostRenderSignal
97 PostRenderSignalType& PostRenderSignal();
101 * This function is called after drawing by dali.
106 * @brief Get the native render surface
107 * @return The render surface
109 NativeRenderSurface* GetNativeRenderSurface() const;
113 * Private constructor
115 * @param[in] width The initial width of the OffscreenWindow
116 * @param[in] height The initial height of the OffscreenWindow
117 * @param[in] surface The native surface handle
118 * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
120 OffscreenWindow(uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent);
123 OffscreenWindow(const OffscreenWindow&);
124 OffscreenWindow& operator=(OffscreenWindow&);
127 * @brief Initialize the OffscreenWindow (for internal use)
132 std::unique_ptr<TriggerEventInterface> mRenderNotification;
133 PostRenderSignalType mPostRenderSignal;
136 inline OffscreenWindow& GetImplementation(Dali::OffscreenWindow& offscreenWindow)
138 DALI_ASSERT_ALWAYS(offscreenWindow && "Dali::OffscreenWindow handle is empty");
140 BaseObject& handle = offscreenWindow.GetBaseObject();
142 return static_cast<OffscreenWindow&>(handle);
145 inline const OffscreenWindow& GetImplementation(const Dali::OffscreenWindow& offscreenWindow)
147 DALI_ASSERT_ALWAYS(offscreenWindow && "Dali::OffscreenWindow handle is empty");
149 const BaseObject& handle = offscreenWindow.GetBaseObject();
151 return static_cast<const OffscreenWindow&>(handle);
154 } // namespace Internal
158 #endif // DALI_INTERNAL_OFFSCREEN_WINDOW_IMPL_H