Merge "Set proper locale to harfbuzz" into devel/master
[platform/core/uifw/dali-adaptor.git] / adaptors / common / gl / egl-factory.cpp
1 /*
2  * Copyright (c) 2017 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 "egl-factory.h"
20
21 // INTERNAL INCLUDES
22 #include <gl/egl-implementation.h>
23 #include <gl/egl-image-extensions.h>
24 #include <gl/egl-sync-implementation.h>
25
26 namespace Dali
27 {
28 namespace Internal
29 {
30 namespace Adaptor
31 {
32
33 EglFactory::EglFactory( int multiSamplingLevel,
34                         Integration::DepthBufferAvailable depthBufferRequired,
35                         Integration::StencilBufferAvailable stencilBufferRequired )
36 : mEglImplementation(NULL),
37   mEglImageExtensions(NULL),
38   mEglSync(new EglSyncImplementation), // Created early, as needed by Core constructor
39   mMultiSamplingLevel( multiSamplingLevel ),
40   mDepthBufferRequired( depthBufferRequired ),
41   mStencilBufferRequired( stencilBufferRequired )
42 {
43 }
44
45 EglFactory::~EglFactory()
46 {
47   // Ensure the EGL implementation is destroyed
48   delete mEglImageExtensions;
49   delete mEglImplementation;
50   delete mEglSync;
51 }
52
53 EglInterface* EglFactory::Create()
54 {
55   // Created by RenderThread (After Core construction)
56   mEglImplementation = new EglImplementation( mMultiSamplingLevel, mDepthBufferRequired, mStencilBufferRequired );
57   mEglImageExtensions = new EglImageExtensions( mEglImplementation );
58
59   mEglSync->Initialize(mEglImplementation); // The sync impl needs the EglDisplay
60   return mEglImplementation;
61 }
62
63 void EglFactory::Destroy()
64 {
65   delete mEglImageExtensions;
66   mEglImageExtensions = NULL;
67   delete mEglImplementation;
68   mEglImplementation = NULL;
69 }
70
71 EglInterface* EglFactory::GetImplementation()
72 {
73   return mEglImplementation;
74 }
75
76 EglImageExtensions* EglFactory::GetImageExtensions()
77 {
78   return mEglImageExtensions;
79 }
80
81 EglSyncImplementation* EglFactory::GetSyncImplementation()
82 {
83   return mEglSync;
84 }
85
86 } // Adaptor
87 } // Internal
88 } // Dali