(gles-context.cpp) Use pipelineState directly instead of dereferencing (SVACE Error)
[platform/core/uifw/dali-adaptor.git] / dali / internal / imaging / android / native-image-source-queue-impl-android.h
1 #ifndef DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_ANDROID_H
2 #define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_ANDROID_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 NativeImageSourceQueueAndroid : public Internal::Adaptor::NativeImageSourceQueue
39 {
40 public:
41   /**
42    * Create a new NativeImageSourceQueueAndroid 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] depth color depth 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 NativeImageSourceQueueAndroid* New(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorDepth depth, 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    * destructor
69    */
70   ~NativeImageSourceQueueAndroid() override;
71
72   /**
73    * @copydoc Dali::NativeImageInterface::CreateResource()
74    */
75   bool CreateResource() override;
76
77   /**
78    * @copydoc Dali::NativeImageInterface::DestroyResource()
79    */
80   void DestroyResource() override;
81
82   /**
83    * @copydoc Dali::NativeImageInterface::TargetTexture()
84    */
85   uint32_t TargetTexture() override;
86
87   /**
88    * @copydoc Dali::NativeImageInterface::PrepareTexture()
89    */
90   void PrepareTexture() override;
91
92   /**
93    * @copydoc Dali::NativeImageInterface::GetWidth()
94    */
95   uint32_t GetWidth() const override
96   {
97     return mWidth;
98   }
99
100   /**
101    * @copydoc Dali::NativeImageInterface::GetHeight()
102    */
103   uint32_t GetHeight() const override
104   {
105     return mHeight;
106   }
107
108   /**
109    * @copydoc Dali::NativeImageInterface::RequiresBlending()
110    */
111   bool RequiresBlending() const override
112   {
113     return true;
114   }
115
116   /**
117    * @copydoc Dali::NativeImageInterface::GetExtension()
118    */
119   NativeImageInterface::Extension* GetNativeImageInterfaceExtension() override
120   {
121     return nullptr;
122   }
123
124   /**
125    * @copydoc Dali::NativeImageInterface::GetCustomFragmentPrefix()
126    */
127   const char* GetCustomFragmentPrefix() const override;
128
129   /**
130    * @copydoc Dali::NativeImageInterface::GetCustomSamplerTypename()
131    */
132   const char* GetCustomSamplerTypename() const override;
133
134   /**
135    * @copydoc Dali::NativeImageInterface::GetTextureTarget()
136    */
137   int GetTextureTarget() const override;
138
139   /**
140    * @copydoc Dali::NativeImageInterface::GetNativeImageHandle()
141    */
142   Any GetNativeImageHandle() const override;
143
144   /**
145    * @copydoc Dali::NativeImageInterface::SourceChanged()
146    */
147   bool SourceChanged() const override;
148
149 private:
150   /**
151    * Private constructor; @see NativeImageSourceQueue::New()
152    * @param[in] width The width of the image.
153    * @param[in] height The height of the image.
154    * @param[in] colour depth of the image.
155    * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
156    */
157   NativeImageSourceQueueAndroid(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorDepth depth, Any nativeImageSourceQueue);
158
159 private:
160   uint32_t mWidth;  ///< image width
161   uint32_t mHeight; ///< image height
162 };
163
164 } // namespace Adaptor
165
166 } // namespace Internal
167
168 } // namespace Dali
169
170 #endif // DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_ANDROID_H