[Tizen] Add OffscreenApplication
[platform/core/uifw/dali-adaptor.git] / dali / internal / offscreen / tizen / offscreen-window-impl-tizen.h
1 #ifndef DALI_INTERNAL_OFFSCREEN_WINDOW_IMPL_TIZEN_H
2 #define DALI_INTERNAL_OFFSCREEN_WINDOW_IMPL_TIZEN_H
3
4 /*
5  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 // #include <memory>
23
24 // #include <dali/integration-api/adaptor-framework/scene-holder-impl.h>
25 // #include <dali/public-api/common/intrusive-ptr.h>
26 // #include <dali/public-api/signals/connection-tracker.h>
27
28 // INTERNAL INCLUDES
29 #include <dali/internal/offscreen/common/offscreen-window-impl.h>
30
31 namespace Dali
32 {
33 class Adaptor;
34 class Layer;
35 class NativeRenderSurface;
36 class TriggerEventInterface;
37
38 namespace Internal
39 {
40
41 class OffscreenWindowTizen : public Dali::Internal::OffscreenWindow
42 {
43 public:
44
45   static OffscreenWindowTizen* New( uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent );
46
47 public:
48
49   /**
50    * @copydoc Dali::OffscreenWindow::GetLayerCount
51    */
52   uint32_t GetLayerCount() const;
53
54   /**
55    * @copydoc Dali::OffscreenWindow::GetLayer
56    */
57   Dali::Layer GetLayer( uint32_t depth ) const;
58
59   /**
60    * @copydoc Dali::OffscreenWindow::GetSize
61    */
62   WindowSize GetSize() const;
63
64   /**
65    * @brief Gets the native handle.
66    * @note When users call this function, it wraps the actual type used by the underlying system.
67    * @return The native handle or an empty handle
68    */
69   Dali::Any GetNativeHandle() const override;
70
71   /*
72    * @brief Initialize the OffscreenWindow
73    * @param[in] offscreenApplication The OffscreenApplication instance to be used to intialize the new window
74    * @param[in] isDefaultWindow Whether the OffscreenWindow is a default one or not
75    */
76   void Initialize( OffscreenApplication* offscreenApplication, bool isDefaultWindow );
77
78   OffscreenWindow::PostRenderSignalType& PostRenderSignal();
79
80 private:
81   /**
82    * This function is called after drawing by dali.
83    */
84   void OnPostRender();
85
86   /**
87    * @brief Get the native render surface
88    * @return The render surface
89    */
90   NativeRenderSurface* GetNativeRenderSurface() const;
91
92 private:
93
94   /**
95    * Private constructor
96    *
97    * @param[in] width The initial width of the OffscreenWindow
98    * @param[in] height The initial height of the OffscreenWindow
99    * @param[in] surface The tbm surface queue handle
100    * @param[in] isTranslucent Whether the OffscreenWindow is translucent or not
101    */
102   OffscreenWindowTizen( uint16_t width, uint16_t height, Dali::Any surface, bool isTranslucent );
103
104   /**
105    * Destructor
106    */
107   virtual ~OffscreenWindowTizen();
108
109   // Undefined
110   OffscreenWindowTizen( const OffscreenWindowTizen& );
111   OffscreenWindowTizen& operator=( OffscreenWindowTizen& );
112
113   /**
114    * This is for initialization of this OffscreenWindow in case it is created before adaptor is running.
115    */
116   void OnPreInitOffscreenApplication();
117
118   /*
119    * @brief Initialize the OffscreenWindow (for internal use)
120    */
121   void Initialize();
122
123 private:
124
125   Dali::Adaptor*                            mAdaptor;
126   std::unique_ptr< TriggerEventInterface >  mRenderNotification;
127   PostRenderSignalType                      mPostRenderSignal;
128   bool                                      mIsTranslucent;
129 };
130
131 } // namespace Internal
132
133 } // namespace Dali
134
135 #endif // DALI_INTERNAL_OFFSCREEN_WINDOW_IMPL_TIZEN_H