Merge "Enable atspi" into devel/master
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / android / display-connection-impl-android.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/graphics/gles/egl-graphics.h>
20 #include <dali/internal/window-system/android/display-connection-impl-android.h>
21
22 // EXTERNAL_HEADERS
23 #include <dali/integration-api/debug.h>
24
25 namespace Dali
26 {
27 namespace Internal
28 {
29 namespace Adaptor
30 {
31 DisplayConnection* DisplayConnectionAndroid::New()
32 {
33   DisplayConnection* pDisplayConnection(new DisplayConnectionAndroid());
34
35   return pDisplayConnection;
36 }
37
38 DisplayConnectionAndroid::DisplayConnectionAndroid()
39 : mDisplay(NULL),
40   mSurfaceType(RenderSurfaceInterface::WINDOW_RENDER_SURFACE),
41   mGraphics(nullptr)
42 {
43 }
44
45 DisplayConnectionAndroid::~DisplayConnectionAndroid() = default;
46
47 Any DisplayConnectionAndroid::GetDisplay()
48 {
49   return Any(mDisplay);
50 }
51
52 void DisplayConnectionAndroid::ConsumeEvents()
53 {
54 }
55
56 bool DisplayConnectionAndroid::InitializeGraphics()
57 {
58   auto               eglGraphics = static_cast<EglGraphics*>(mGraphics);
59   EglImplementation& eglImpl     = eglGraphics->GetEglImplementation();
60
61   if(!eglImpl.InitializeGles(mDisplay))
62   {
63     DALI_LOG_ERROR("Failed to initialize GLES.\n");
64     return false;
65   }
66
67   return true;
68 }
69
70 void DisplayConnectionAndroid::SetSurfaceType(Dali::RenderSurfaceInterface::Type type)
71 {
72   mSurfaceType = type;
73   mDisplay     = EGL_DEFAULT_DISPLAY;
74 }
75
76 void DisplayConnectionAndroid::SetGraphicsInterface(GraphicsInterface& graphics)
77 {
78   mGraphics = &graphics;
79 }
80
81 } // namespace Adaptor
82
83 } // namespace Internal
84
85 } // namespace Dali