689f733f9c80665910f768f0c235b34ff473862e
[platform/core/uifw/dali-adaptor.git] / dali / internal / imaging / ubuntu-x11 / native-image-source-queue-impl-x.h
1 #ifndef DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_X_H
2 #define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_X_H
3
4 /*
5  * Copyright (c) 2018 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/devel-api/images/native-image-interface-extension.h>
23
24 // INTERNAL INCLUDES
25 #include <dali/internal/imaging/common/native-image-source-queue-impl.h>
26
27 namespace Dali
28 {
29
30 namespace Internal
31 {
32
33 namespace Adaptor
34 {
35
36 class EglGraphics;
37 class EglImageExtensions;
38
39 /**
40  * Dali internal NativeImageSourceQueue.
41  */
42 class NativeImageSourceQueueX: public Internal::Adaptor::NativeImageSourceQueue, public NativeImageInterface::Extension
43 {
44 public:
45
46   /**
47    * Create a new NativeImageSourceQueueX internally.
48    * Depending on hardware the width and height may have to be a power of two.
49    * @param[in] width The width of the image.
50    * @param[in] height The height of the image.
51    * @param[in] depth color depth of the image.
52    * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
53    * @return A smart-pointer to a newly allocated image.
54    */
55   static NativeImageSourceQueueX* New( uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorDepth depth, Any nativeImageSourceQueue );
56
57   /**
58    * @copydoc Dali::NativeImageSourceQueue::GetNativeImageSourceQueue()
59    */
60   Any GetNativeImageSourceQueue() const override;
61
62   /**
63    * @copydoc Dali::NativeImageSourceQueue::SetSize
64    */
65   void SetSize( uint32_t width, uint32_t height ) override;
66
67   /**
68    * @copydoc Dali::NativeImageSourceQueue::IgnoreSourceImage
69    */
70   void IgnoreSourceImage() override;
71
72   /**
73    * destructor
74    */
75   ~NativeImageSourceQueueX() override;
76
77   /**
78    * @copydoc Dali::NativeImageInterface::GlExtensionCreate()
79    */
80   bool GlExtensionCreate() override;
81
82   /**
83    * @copydoc Dali::NativeImageInterface::GlExtensionDestroy()
84    */
85   void GlExtensionDestroy() override;
86
87   /**
88    * @copydoc Dali::NativeImageInterface::TargetTexture()
89    */
90   uint32_t TargetTexture() override;
91
92   /**
93    * @copydoc Dali::NativeImageInterface::PrepareTexture()
94    */
95   void PrepareTexture() override;
96
97   /**
98    * @copydoc Dali::NativeImageInterface::GetWidth()
99    */
100   uint32_t GetWidth() const override
101   {
102     return mWidth;
103   }
104
105   /**
106    * @copydoc Dali::NativeImageInterface::GetHeight()
107    */
108   uint32_t GetHeight() const override
109   {
110     return mHeight;
111   }
112
113   /**
114    * @copydoc Dali::NativeImageInterface::RequiresBlending()
115    */
116   bool RequiresBlending() const override
117   {
118     return true;
119   }
120
121   /**
122    * @copydoc Dali::NativeImageInterface::GetExtension()
123    */
124   NativeImageInterface::Extension* GetNativeImageInterfaceExtension() override
125   {
126     return this;
127   }
128
129   /**
130    * @copydoc Dali::NativeImageInterface::Extension::GetCustomFragmentPreFix()
131    */
132   const char* GetCustomFragmentPreFix() override;
133
134   /**
135    * @copydoc Dali::NativeImageInterface::Extension::GetCustomSamplerTypename()
136    */
137   const char* GetCustomSamplerTypename() override;
138
139   /**
140    * @copydoc Dali::NativeImageInterface::Extension::GetEglImageTextureTarget()
141    */
142   int GetEglImageTextureTarget() override;
143
144 private:
145
146   /**
147    * Private constructor; @see NativeImageSourceQueue::New()
148    * @param[in] width The width of the image.
149    * @param[in] height The height of the image.
150    * @param[in] colour depth of the image.
151    * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
152    */
153   NativeImageSourceQueueX( uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorDepth depth, Any nativeImageSourceQueue );
154
155 private:
156
157   uint32_t    mWidth;                ///< image width
158   uint32_t    mHeight;               ///< image height
159
160 };
161
162 } // namespace Adaptor
163
164 } // namespace Internal
165
166 } // namespace Dali
167
168 #endif // DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_X_H