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