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