Initial refactoring of graphics interface
[platform/core/uifw/dali-adaptor.git] / dali / internal / graphics / gles / egl-graphics-controller.h
1 #ifndef DALI_EGL_GRAPHICS_CONTROLLER_H
2 #define DALI_EGL_GRAPHICS_CONTROLLER_H
3
4 /*
5  * Copyright (c) 2021 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 #include <dali/graphics-api/graphics-controller.h>
21
22 namespace Dali
23 {
24 namespace Integration
25 {
26 class GlAbstraction;
27 class GlSyncAbstraction;
28 class GlContextHelperAbstraction;
29 } // namespace Integration
30
31 namespace Graphics
32 {
33 /**
34  * EGL Implementation of the graphics controller.
35  *
36  * Temporarily holds the old GL abstractions whilst dali-core is migrated to the new API.
37  */
38 class EglGraphicsController : public Graphics::Controller
39 {
40 public:
41   EglGraphicsController() = default;
42
43   virtual ~EglGraphicsController() = default;
44
45   /**
46    * Initialize the GLES abstraction. This can be called from the main thread.
47    */
48   void InitializeGLES(Integration::GlAbstraction& glAbstraction);
49
50   /**
51    * Initialize with a reference to the GL abstractions.
52    *
53    * Note, this is now executed in the render thread, after core initialization
54    */
55   void Initialize(Integration::GlSyncAbstraction&          glSyncAbstraction,
56                   Integration::GlContextHelperAbstraction& glContextHelperAbstraction);
57
58   Integration::GlAbstraction&              GetGlAbstraction() override;
59   Integration::GlSyncAbstraction&          GetGlSyncAbstraction() override;
60   Integration::GlContextHelperAbstraction& GetGlContextHelperAbstraction() override;
61
62 private:
63   Integration::GlAbstraction*              mGlAbstraction{nullptr};
64   Integration::GlSyncAbstraction*          mGlSyncAbstraction{nullptr};
65   Integration::GlContextHelperAbstraction* mGlContextHelperAbstraction{nullptr};
66 };
67
68 } // namespace Graphics
69
70 } // namespace Dali
71
72 #endif //DALI_EGL_GRAPHICS_CONTROLLER_H