Revert "[Tizen] Remove to call key consumed event in ATSPI bridge"
[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) 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
23 // INTERNAL INCLUDES
24 #include <dali/internal/imaging/common/native-image-source-queue-impl.h>
25
26 namespace Dali
27 {
28 namespace Internal
29 {
30 namespace Adaptor
31 {
32 class EglGraphics;
33 class EglImageExtensions;
34
35 /**
36  * Dali internal NativeImageSourceQueue.
37  */
38 class NativeImageSourceQueueX : public Internal::Adaptor::NativeImageSourceQueue
39 {
40 public:
41   /**
42    * Create a new NativeImageSourceQueueX internally.
43    * Depending on hardware the width and height may have to be a power of two.
44    * @param[in] width The width of the image.
45    * @param[in] height The height of the image.
46    * @param[in] colorFormat The color format of the image.
47    * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
48    * @return A smart-pointer to a newly allocated image.
49    */
50   static NativeImageSourceQueueX* New(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue);
51
52   /**
53    * @copydoc Dali::NativeImageSourceQueue::GetNativeImageSourceQueue()
54    */
55   Any GetNativeImageSourceQueue() const override;
56
57   /**
58    * @copydoc Dali::NativeImageSourceQueue::SetSize
59    */
60   void SetSize(uint32_t width, uint32_t height) override;
61
62   /**
63    * @copydoc Dali::NativeImageSourceQueue::IgnoreSourceImage
64    */
65   void IgnoreSourceImage() override;
66
67   /**
68    * @copydoc Dali::NativeImageSourceQueue::CanDequeueBuffer
69    */
70   bool CanDequeueBuffer() override;
71
72   /**
73    * @copydoc Dali::NativeImageSourceQueue::DequeueBuffer
74    */
75   uint8_t* DequeueBuffer(uint32_t& width, uint32_t& height, uint32_t& stride) override;
76
77   /**
78    * @copydoc Dali::NativeImageSourceQueue::EnqueueBuffer
79    */
80   bool EnqueueBuffer(uint8_t* buffer) override;
81
82   /**
83    * destructor
84    */
85   ~NativeImageSourceQueueX() override;
86
87   /**
88    * @copydoc Dali::NativeImageInterface::CreateResource()
89    */
90   bool CreateResource() override;
91
92   /**
93    * @copydoc Dali::NativeImageInterface::DestroyResource()
94    */
95   void DestroyResource() override;
96
97   /**
98    * @copydoc Dali::NativeImageInterface::TargetTexture()
99    */
100   uint32_t TargetTexture() override;
101
102   /**
103    * @copydoc Dali::NativeImageInterface::PrepareTexture()
104    */
105   void PrepareTexture() override;
106
107   /**
108    * @copydoc Dali::NativeImageInterface::GetWidth()
109    */
110   uint32_t GetWidth() const override
111   {
112     return mWidth;
113   }
114
115   /**
116    * @copydoc Dali::NativeImageInterface::GetHeight()
117    */
118   uint32_t GetHeight() const override
119   {
120     return mHeight;
121   }
122
123   /**
124    * @copydoc Dali::NativeImageInterface::RequiresBlending()
125    */
126   bool RequiresBlending() const override
127   {
128     return true;
129   }
130
131   /**
132    * @copydoc Dali::NativeImageInterface::GetTextureTarget()
133    */
134   int GetTextureTarget() const override;
135
136   /**
137    * @copydoc Dali::NativeImageInterface::ApplyNativeFragmentShader()
138    */
139   bool ApplyNativeFragmentShader(std::string& shader) override;
140
141   /**
142    * @copydoc Dali::NativeImageInterface::GetCustomSamplerTypename()
143    */
144   const char* GetCustomSamplerTypename() const override;
145
146   /**
147    * @copydoc Dali::NativeImageInterface::GetNativeImageHandle()
148    */
149   Any GetNativeImageHandle() const override;
150
151   /**
152    * @copydoc Dali::NativeImageInterface::SourceChanged()
153    */
154   bool SourceChanged() const override;
155
156   /**
157    * @copydoc Dali::NativeImageInterface::GetExtension()
158    */
159   NativeImageInterface::Extension* GetNativeImageInterfaceExtension() override
160   {
161     return nullptr;
162   }
163
164 private:
165   /**
166    * Private constructor; @see NativeImageSourceQueue::New()
167    * @param[in] width The width of the image.
168    * @param[in] height The height of the image.
169    * @param[in] colorFormat The color format of the image.
170    * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
171    */
172   NativeImageSourceQueueX(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue);
173
174 private:
175   uint32_t mWidth;  ///< image width
176   uint32_t mHeight; ///< image height
177 };
178
179 } // namespace Adaptor
180
181 } // namespace Internal
182
183 } // namespace Dali
184
185 #endif // DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_X_H