[dali_2.3.25] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / display-connection.cpp
1 /*
2  * Copyright (c) 2021 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/internal/window-system/common/display-connection-factory.h>
20 #include <dali/internal/window-system/common/display-connection.h>
21
22 // INTERNAL INCLUDES
23 #include <dali/internal/window-system/common/display-connection-factory.h>
24 #include <dali/internal/window-system/common/display-connection-impl.h>
25
26 namespace Dali
27 {
28 DisplayConnection* DisplayConnection::New(Dali::Internal::Adaptor::GraphicsInterface& graphics)
29 {
30   auto factory           = Dali::Internal::Adaptor::GetDisplayConnectionFactory();
31   auto displayConnection = factory->CreateDisplayConnection();
32
33   Internal::Adaptor::DisplayConnection* internal(displayConnection.release());
34   internal->SetGraphicsInterface(graphics);
35
36   return new DisplayConnection(internal);
37 }
38
39 DisplayConnection* DisplayConnection::New(Dali::Internal::Adaptor::GraphicsInterface& graphics, Dali::RenderSurfaceInterface::Type type)
40 {
41   auto factory           = Dali::Internal::Adaptor::GetDisplayConnectionFactory();
42   auto displayConnection = factory->CreateDisplayConnection();
43
44   Internal::Adaptor::DisplayConnection* internal(displayConnection.release());
45
46   internal->SetGraphicsInterface(graphics);
47   internal->SetSurfaceType(type);
48
49   return new DisplayConnection(internal);
50 }
51
52 DisplayConnection::DisplayConnection() = default;
53
54 DisplayConnection::~DisplayConnection() = default;
55
56 DisplayConnection::DisplayConnection(Internal::Adaptor::DisplayConnection* impl)
57 {
58   mImpl.reset(impl);
59 }
60
61 Any DisplayConnection::GetDisplay()
62 {
63   return mImpl->GetDisplay();
64 }
65
66 void DisplayConnection::ConsumeEvents()
67 {
68   mImpl->ConsumeEvents();
69 }
70
71 bool DisplayConnection::Initialize()
72 {
73   return mImpl->InitializeGraphics();
74 }
75
76 } // namespace Dali