[Tizen] ecore-wl2: applying ecore-wl2
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / display-connection.cpp
1 /*
2  * Copyright (c) 2015 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 // EXTERNAL INCLUDES
22
23 // INTERNAL INCLUDES
24 #include <dali/internal/window-system/common/display-connection-impl.h>
25 #include <dali/internal/window-system/common/display-connection-factory.h>
26 #include <dali/integration-api/egl-interface.h>
27
28 namespace Dali
29 {
30
31 DisplayConnection* DisplayConnection::New()
32 {
33   auto factory = Dali::Internal::Adaptor::GetDisplayConnectionFactory();
34   auto displayConnection = factory->CreateDisplayConnection();
35
36   Internal::Adaptor::DisplayConnection* internal( displayConnection.release() );
37
38   return new DisplayConnection(internal);
39 }
40
41 DisplayConnection* DisplayConnection::New( RenderSurface::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->SetSurfaceType( type );
49
50   return new DisplayConnection(internal);
51 }
52
53 DisplayConnection::DisplayConnection() = default;
54
55 DisplayConnection::~DisplayConnection() = default;
56
57 DisplayConnection::DisplayConnection(Internal::Adaptor::DisplayConnection* impl)
58 {
59   mImpl.reset( impl );
60 }
61
62 Any DisplayConnection::GetDisplay()
63 {
64   return mImpl->GetDisplay();
65 }
66
67 void DisplayConnection::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
68 {
69   Internal::Adaptor::DisplayConnection::GetDpi(dpiHorizontal, dpiVertical);
70 }
71
72 void DisplayConnection::GetDpi(Any nativeWindow, unsigned int& dpiHorizontal, unsigned int& dpiVertical)
73 {
74   Internal::Adaptor::DisplayConnection::GetDpi(nativeWindow, dpiHorizontal, dpiVertical);
75 }
76
77 void DisplayConnection::ConsumeEvents()
78 {
79   mImpl->ConsumeEvents();
80 }
81
82 bool DisplayConnection::InitializeEgl(EglInterface& egl)
83 {
84   return mImpl->InitializeEgl(egl);
85 }
86
87 }