Add NativeImageSurface
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / tizen-wayland / native-image-surface-impl-ecore-wl.h
1 #ifndef DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_IMAGE_SURFACE_IMPL_ECORE_WL_H
2 #define DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_IMAGE_SURFACE_IMPL_ECORE_WL_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
21 // EXTERNAL INCLUDES
22 #include <dali/public-api/object/any.h>
23 #include <tbm_surface.h>
24 #include <tbm_surface_queue.h>
25
26 // INTERNAL INCLUDES
27 #include <dali/devel-api/adaptor-framework/native-image-source-queue.h>
28 #include <dali/integration-api/adaptor-framework/egl-interface.h>
29 #include <dali/internal/graphics/common/graphics-interface.h>
30 #include <dali/internal/window-system/common/display-connection.h>
31 #include <dali/internal/window-system/common/native-image-surface-impl.h>
32
33 namespace Dali
34 {
35 namespace Internal
36 {
37 namespace Adaptor
38 {
39 class NativeImageSurfaceEcoreWl : public Dali::Internal::Adaptor::NativeImageSurface
40 {
41 public:
42   /**
43     * @param [in] queue the NativeImageSourceQueue pointer
44     */
45   NativeImageSurfaceEcoreWl(Dali::NativeImageSourceQueuePtr queue);
46
47   /**
48    * @brief Destructor
49    */
50   ~NativeImageSurfaceEcoreWl() = default;
51
52 public:
53   /**
54    * @copydoc Dali::NativeImageSurface::GetNativeRenderable()
55    */
56   Any GetNativeRenderable() override;
57
58   /**
59    * @copydoc Dali::NativeImageSurface::InitializeGraphics()
60    */
61   void InitializeGraphics() override;
62
63   /**
64    * @copydoc Dali::NativeImageSurface::TerminateGraphics()
65    */
66   void TerminateGraphics() override;
67
68   /**
69    * @copydoc Dali::NativeImageSurface::PreRender()
70    */
71   void PreRender() override;
72
73   /**
74    * @copydoc Dali::NativeImageSurface::PostRender()
75    */
76   void PostRender() override;
77
78   /**
79    * @copydoc Dali::NativeImageSurface::CanRender()
80    */
81   bool CanRender() override;
82
83   /**
84    * @copydoc Dali::NativeImageSurface::SetGraphicsConfig()
85    */
86   bool SetGraphicsConfig(bool depth, bool stencil, int msaa, int version) override;
87
88 private:
89   void MakeContextCurrent();
90
91 private:                                                       // Data
92   std::unique_ptr<Dali::DisplayConnection> mDisplayConnection; ///< The native display connection
93   std::unique_ptr<GraphicsInterface>       mGraphics;          ///< Graphics interface
94   EglInterface*                            mEGL;
95   EGLSurface                               mEGLSurface;
96   EGLContext                               mEGLContext;
97   ColorDepth                               mColorDepth;
98   tbm_format                               mTbmFormat;
99   tbm_surface_queue_h                      mTbmQueue;
100
101   bool mDepth : 1;
102   bool mStencil : 1;
103   int  mGLESVersion;
104   int  mMSAA;
105 };
106
107 } // namespace Adaptor
108 } // namespace Internal
109 } // namespace Dali
110
111 #endif // DALI_INTERNAL_WINDOWSYSTEM_TIZENWAYLAND_NATIVE_IMAGE_SURFACE_IMPL_ECORE_WL_H