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>
26 #include <dali/devel-api/adaptor-framework/offscreen-window.h>
27 #include <dali/integration-api/adaptor-framework/scene-holder-impl.h>
33 class NativeRenderSurface;
34 class TriggerEventInterface;
39 * Implementation of the OffscreenWindow class.
41 class OffscreenWindow : public Dali::Internal::Adaptor::SceneHolder
44 using WindowSize = Dali::OffscreenWindow::WindowSize;
47 * @brief Create a new OffscreenWindow
49 * @param[in] width The initial width of the OffscreenWindow
50 * @param[in] height The initial height of the OffscreenWindow
51 * @param[in] surface The native surface handle of your platform
52 * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
54 static OffscreenWindow* New(uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent);
56 OffscreenWindow() = default;
65 * @copydoc Dali::OffscreenWindow::GetLayerCount
67 uint32_t GetLayerCount() const;
70 * @copydoc Dali::OffscreenWindow::GetLayer
72 Dali::Layer GetLayer(uint32_t depth) const;
75 * @copydoc Dali::OffscreenWindow::GetSize
77 WindowSize GetSize() const;
80 * @copydoc Dali::OffscreenWindow::GetNativeHandle
82 Any GetNativeHandle() const override;
85 * @copydoc Dali::OffscreenWindow::SetPostRenderCallback
87 void SetPostRenderCallback(CallbackBase* callback);
90 * @brief Initialize the OffscreenWindow
91 * @param[in] isDefaultWindow Whether the OffscreenWindow is a default one or not
93 void Initialize(bool isDefaultWindow);
97 * This function is called after drawing by dali.
102 * @brief Get the native render surface
103 * @return The render surface
105 NativeRenderSurface* GetNativeRenderSurface() const;
109 * Private constructor
111 * @param[in] width The initial width of the OffscreenWindow
112 * @param[in] height The initial height of the OffscreenWindow
113 * @param[in] surface The native surface handle
114 * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
116 OffscreenWindow(uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent);
119 OffscreenWindow(const OffscreenWindow&);
120 OffscreenWindow& operator=(OffscreenWindow&);
123 std::unique_ptr<TriggerEventInterface> mRenderNotification;
124 std::unique_ptr<CallbackBase> mPostRenderCallback;
127 inline OffscreenWindow& GetImplementation(Dali::OffscreenWindow& offscreenWindow)
129 DALI_ASSERT_ALWAYS(offscreenWindow && "Dali::OffscreenWindow handle is empty");
131 BaseObject& handle = offscreenWindow.GetBaseObject();
133 return static_cast<OffscreenWindow&>(handle);
136 inline const OffscreenWindow& GetImplementation(const Dali::OffscreenWindow& offscreenWindow)
138 DALI_ASSERT_ALWAYS(offscreenWindow && "Dali::OffscreenWindow handle is empty");
140 const BaseObject& handle = offscreenWindow.GetBaseObject();
142 return static_cast<const OffscreenWindow&>(handle);
145 } // namespace Internal
149 #endif // DALI_INTERNAL_OFFSCREEN_WINDOW_IMPL_H