1 #ifndef DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_TIZEN_H
2 #define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_TIZEN_H
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/devel-api/images/native-image-interface-extension.h>
23 #include <dali/public-api/common/vector-wrapper.h>
24 #include <tbm_surface.h>
25 #include <tbm_surface_queue.h>
28 #include <dali/internal/imaging/common/native-image-source-queue-impl.h>
39 class EglImageExtensions;
42 * Dali internal NativeImageSource.
44 class NativeImageSourceQueueTizen: public Internal::Adaptor::NativeImageSourceQueue, public NativeImageInterface::Extension
49 * Create a new NativeImageSourceQueueTizen internally.
50 * Depending on hardware the width and height may have to be a power of two.
51 * @param[in] width The width of the image.
52 * @param[in] height The height of the image.
53 * @param[in] depth color depth of the image.
54 * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
55 * @return A smart-pointer to a newly allocated image.
57 static NativeImageSourceQueueTizen* New(unsigned int width, unsigned int height, Dali::NativeImageSourceQueue::ColorDepth depth, Any nativeImageSourceQueue );
60 * @copydoc Dali::NativeImageSourceQueue::GetNativeImageSourceQueue()
62 Any GetNativeImageSourceQueue() const override;
65 * @copydoc Dali::NativeImageSourceQueue::SetSource( Any source )
67 void SetSource( Any source ) override;
72 ~NativeImageSourceQueueTizen() override;
75 * @copydoc Dali::NativeImageInterface::GlExtensionCreate()
77 bool GlExtensionCreate() override;
80 * @copydoc Dali::NativeImageInterface::GlExtensionDestroy()
82 void GlExtensionDestroy() override;
85 * @copydoc Dali::NativeImageInterface::TargetTexture()
87 unsigned int TargetTexture() override;
90 * @copydoc Dali::NativeImageInterface::PrepareTexture()
92 void PrepareTexture() override;
95 * @copydoc Dali::NativeImageInterface::GetWidth()
97 unsigned int GetWidth() const override
103 * @copydoc Dali::NativeImageInterface::GetHeight()
105 unsigned int GetHeight() const override
111 * @copydoc Dali::NativeImageInterface::RequiresBlending()
113 bool RequiresBlending() const override
115 return mBlendingRequired;
119 * @copydoc Dali::NativeImageInterface::GetExtension()
121 NativeImageInterface::Extension* GetNativeImageInterfaceExtension() override
127 * @copydoc Dali::NativeImageInterface::Extension::GetCustomFragmentPreFix()
129 const char* GetCustomFragmentPreFix() override;
132 * @copydoc Dali::NativeImageInterface::Extension::GetCustomSamplerTypename()
134 const char* GetCustomSamplerTypename() override;
137 * @copydoc Dali::NativeImageInterface::Extension::GetEglImageTextureTarget()
139 int GetEglImageTextureTarget() override;
144 * Private constructor; @see NativeImageSourceQueue::New()
145 * @param[in] width The width of the image.
146 * @param[in] height The height of the image.
147 * @param[in] colour depth of the image.
148 * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
150 NativeImageSourceQueueTizen( unsigned int width, unsigned int height, Dali::NativeImageSourceQueue::ColorDepth depth, Any nativeImageSourceQueue );
152 void Initialize( Dali::NativeImageSourceQueue::ColorDepth depth );
156 tbm_surface_queue_h GetSurfaceFromAny( Any source ) const;
158 bool CheckBlending( int format );
162 typedef std::pair< tbm_surface_h, void* > EglImagePair;
164 unsigned int mWidth; ///< image width
165 unsigned int mHeight; ///< image height
166 tbm_surface_queue_h mTbmQueue; ///< Tbm surface queue handle
167 tbm_surface_h mConsumeSurface; ///< The current tbm surface
168 std::vector< EglImagePair > mEglImages; ///< EGL Image vector
169 EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions
170 bool mOwnTbmQueue; ///< Whether we created tbm queue
171 bool mBlendingRequired; ///< Whether blending is required
174 } // namespace Adaptor
176 } // namespace Internal
180 #endif // DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_TIZEN_H