[3.0] NativeImageSource with tbm_surface for tizen 3.0 wayland
[platform/core/uifw/dali-adaptor.git] / adaptors / common / gl / egl-image-extensions.h
1 #ifndef __DALI_INTERNAL_EGL_IMAGE_EXTENSIONS_H__
2 #define __DALI_INTERNAL_EGL_IMAGE_EXTENSIONS_H__
3
4 /*
5  * Copyright (c) 2014 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 <EGL/egl.h>
23
24 #include <dali/public-api/images/pixel.h>
25
26 namespace Dali
27 {
28 namespace Internal
29 {
30 namespace Adaptor
31 {
32 class EglImplementation;
33
34 /**
35  * EglImageExtensions class provides EGL image extension support
36  */
37 class EglImageExtensions
38 {
39 public:
40   /**
41    * Constructor
42    */
43   EglImageExtensions(EglImplementation* impl);
44
45   /**
46    * Destructor
47    */
48   ~EglImageExtensions();
49
50
51 public:   // EGLImageKHR extension support
52
53   /**
54    * If the EGL Image extension is available this function returns a
55    * EGLImageKHR
56    * @param clientBuffer Client buffer to use for image creation
57    * @return an object that holds a EGLImageKHR
58    */
59   void* CreateImageKHR(EGLClientBuffer clientBuffer);
60
61   /**
62    * If the EGL Image extension is available this function
63    * destroys the a EGLImageKHR
64    * @param eglImageKHR Object that holds a EGLImageKHR
65    */
66   void DestroyImageKHR(void* eglImageKHR);
67
68   /**
69    * defines a 2D texture
70    * @param eglImageKHR Object that holds a EGLImageKHR
71    */
72   void TargetTextureKHR(void* eglImageKHR);
73
74   /**
75    * Get the functions for using ImageKHR
76    */
77   void InitializeEglImageKHR();
78
79 private:
80   EglImplementation* mEglImplementation;
81
82   bool mImageKHRInitialized;             ///< Flag for whether extended KHR functions loaded
83   bool mImageKHRInitializeFailed;        ///< Flag to avoid trying to reload extended KHR functions, if
84                                          /// it fails the first time
85 };
86
87 } // namespace Adaptor
88
89 } // namespace Internal
90
91 } // namespace Dali
92
93 #endif // __DALI_INTERNAL_EGL_IMAGE_EXTENSIONS_H__