Minor coverity issue fixes
[platform/core/uifw/dali-adaptor.git] / dali / devel-api / adaptor-framework / offscreen-window.cpp
1 /*
2  * Copyright (c) 2022 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 // CLASS HEADER
19 #include <dali/devel-api/adaptor-framework/offscreen-window.h>
20
21 // EXTENRAL INCLUDES
22 #include <dali/public-api/actors/layer.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/internal/offscreen/common/offscreen-window-impl.h>
26
27 namespace Dali
28 {
29 OffscreenWindow OffscreenWindow::New(uint16_t width, uint16_t height, bool isTranslucent)
30 {
31   Any                                     surface;
32   IntrusivePtr<Internal::OffscreenWindow> impl   = Internal::OffscreenWindow::New(width, height, surface, isTranslucent);
33   OffscreenWindow                         window = OffscreenWindow(impl.Get());
34   impl->Initialize(false);
35
36   return window;
37 }
38
39 OffscreenWindow OffscreenWindow::New(Any surface)
40 {
41   IntrusivePtr<Internal::OffscreenWindow> impl   = Internal::OffscreenWindow::New(0, 0, surface, false);
42   OffscreenWindow                         window = OffscreenWindow(impl.Get());
43   impl->Initialize(false);
44
45   return window;
46 }
47
48 OffscreenWindow::OffscreenWindow() = default;
49
50 OffscreenWindow::OffscreenWindow(const OffscreenWindow& window) = default;
51
52 OffscreenWindow& OffscreenWindow::operator=(const OffscreenWindow& window) = default;
53
54 OffscreenWindow::OffscreenWindow(OffscreenWindow&& window) = default;
55
56 OffscreenWindow& OffscreenWindow::operator=(OffscreenWindow&& window) = default;
57
58 OffscreenWindow::~OffscreenWindow() = default;
59
60 void OffscreenWindow::Add(Actor actor)
61 {
62   Internal::GetImplementation(*this).Add(actor);
63 }
64
65 void OffscreenWindow::Remove(Actor actor)
66 {
67   Internal::GetImplementation(*this).Remove(actor);
68 }
69
70 void OffscreenWindow::SetBackgroundColor(const Vector4& color)
71 {
72   Internal::GetImplementation(*this).SetBackgroundColor(color);
73 }
74
75 Vector4 OffscreenWindow::GetBackgroundColor() const
76 {
77   return Internal::GetImplementation(*this).GetBackgroundColor();
78 }
79
80 Layer OffscreenWindow::GetRootLayer() const
81 {
82   return Internal::GetImplementation(*this).GetRootLayer();
83 }
84
85 uint32_t OffscreenWindow::GetLayerCount() const
86 {
87   return Internal::GetImplementation(*this).GetLayerCount();
88 }
89
90 Layer OffscreenWindow::GetLayer(uint32_t depth) const
91 {
92   return Internal::GetImplementation(*this).GetLayer(depth);
93 }
94
95 OffscreenWindow::WindowSize OffscreenWindow::GetSize() const
96 {
97   return Internal::GetImplementation(*this).GetSize();
98 }
99
100 Any OffscreenWindow::GetNativeHandle() const
101 {
102   return Internal::GetImplementation(*this).GetNativeHandle();
103 }
104
105 Uint16Pair OffscreenWindow::GetDpi() const
106 {
107   return Internal::GetImplementation(*this).GetDpi();
108 }
109
110 void OffscreenWindow::SetPostRenderCallback(CallbackBase* callback)
111 {
112   Internal::GetImplementation(*this).SetPostRenderCallback(callback);
113 }
114
115 OffscreenWindow::OffscreenWindow(Internal::OffscreenWindow* window)
116 : BaseHandle(window)
117 {
118 }
119
120 } // namespace Dali