Revert "[Tizen] Add GlWindow"
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / offscreen-window.cpp
1 /*
2  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  *
16  */
17
18 // EXTENRAL INCLUDES
19 #include <dali/public-api/actors/layer.h>
20
21 // INTERNAL INCLUDES
22 #include <dali/internal/offscreen/common/offscreen-application-impl.h>
23 #include <dali/internal/offscreen/common/offscreen-window-impl.h>
24 #include <dali/internal/offscreen/common/offscreen-window-factory.h>
25
26 // CLASS HEADER
27 #include <dali/devel-api/adaptor-framework/offscreen-window.h>
28
29 namespace Dali
30 {
31 OffscreenWindow OffscreenWindow::New( uint16_t width, uint16_t height, bool isTranslucent )
32 {
33   auto windowFactory = Dali::Internal::GetOffscreenWindowFactory();
34   Any surface;
35   IntrusivePtr < Internal::OffscreenWindow > impl = windowFactory->CreateOffscreenWindow( width, height, surface, isTranslucent ).release();
36   OffscreenWindow window = OffscreenWindow( impl.Get() );
37   impl->Initialize( false );
38
39   return window;
40 }
41
42 OffscreenWindow OffscreenWindow::New( Any surface, bool isTranslucent )
43 {
44   auto windowFactory = Dali::Internal::GetOffscreenWindowFactory();
45   IntrusivePtr < Internal::OffscreenWindow > impl = windowFactory->CreateOffscreenWindow( 0, 0, surface, isTranslucent ).release();
46   OffscreenWindow window = OffscreenWindow( impl.Get() );
47   impl->Initialize( false );
48
49   return window;
50 }
51
52 OffscreenWindow::OffscreenWindow()
53 {
54 }
55
56 OffscreenWindow::OffscreenWindow( const OffscreenWindow& window )
57 : BaseHandle( window )
58 {
59 }
60
61 OffscreenWindow& OffscreenWindow::operator=( const OffscreenWindow& window )
62 {
63   if( *this != window )
64   {
65     BaseHandle::operator=( window );
66   }
67   return *this;
68 }
69
70 OffscreenWindow::~OffscreenWindow()
71 {
72 }
73
74 void OffscreenWindow::Add( Actor actor )
75 {
76   Internal::GetImplementation( *this ).Add( actor );
77 }
78
79 void OffscreenWindow::Remove( Actor actor )
80 {
81   Internal::GetImplementation( *this ).Remove( actor );
82 }
83
84 void OffscreenWindow::SetBackgroundColor( const Vector4& color )
85 {
86   Internal::GetImplementation( *this ).SetBackgroundColor( color );
87 }
88
89 Vector4 OffscreenWindow::GetBackgroundColor() const
90 {
91   return Internal::GetImplementation( *this ).GetBackgroundColor();
92 }
93
94 Layer OffscreenWindow::GetRootLayer() const
95 {
96   return Internal::GetImplementation( *this ).GetRootLayer();
97 }
98
99 uint32_t OffscreenWindow::GetLayerCount() const
100 {
101   return Internal::GetImplementation( *this ).GetLayerCount();
102 }
103
104 Layer OffscreenWindow::GetLayer( uint32_t depth ) const
105 {
106   return Internal::GetImplementation( *this ).GetLayer( depth );
107 }
108
109 OffscreenWindow::WindowSize OffscreenWindow::GetSize() const
110 {
111   return Internal::GetImplementation( *this ).GetSize();
112 }
113
114 Any OffscreenWindow::GetNativeHandle() const
115 {
116   return Internal::GetImplementation( *this ).GetNativeHandle();
117 }
118
119 OffscreenWindow::PostRenderSignalType& OffscreenWindow::PostRenderSignal()
120 {
121   return Internal::GetImplementation( *this ).PostRenderSignal();
122 }
123
124
125 OffscreenWindow::OffscreenWindow( Internal::OffscreenWindow* window )
126 : BaseHandle( window )
127 {
128 }
129
130 }  // namespace Dali