X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fimaging%2Ftizen%2Fnative-image-source-impl-tizen.h;h=7f48b929e7f907c6479b90bf132a26ee71ebc241;hb=a82c4156e6f21ef623354cce5679319a5081c74d;hp=18930cc4376a67f1a7076157dfbb12a342580e8f;hpb=fe8f8ee27e49309bfe4b1400ee0c279da3d8336d;p=platform%2Fcore%2Fuifw%2Fdali-adaptor.git diff --git a/dali/internal/imaging/tizen/native-image-source-impl-tizen.h b/dali/internal/imaging/tizen/native-image-source-impl-tizen.h old mode 100755 new mode 100644 index 18930cc..7f48b92 --- a/dali/internal/imaging/tizen/native-image-source-impl-tizen.h +++ b/dali/internal/imaging/tizen/native-image-source-impl-tizen.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_IMPL_TIZEN_H /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,45 +19,42 @@ */ // EXTERNAL INCLUDES -#include -#include +#include #include +#include // INTERNAL INCLUDES -#include #include +#include namespace Dali { - namespace Internal { - namespace Adaptor { - +class EglGraphics; class EglImageExtensions; /** * Dali internal NativeImageSource. */ -class NativeImageSourceTizen: public Internal::Adaptor::NativeImageSource, public NativeImageInterface::Extension +class NativeImageSourceTizen : public Internal::Adaptor::NativeImageSource { public: - /** * Create a new NativeImageSource internally. * Depending on hardware the width and height may have to be a power of two. * @param[in] width The width of the image. * @param[in] height The height of the image. * @param[in] depth color depth of the image. - * @param[in] nativeImageSource contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty + * @param[in] nativeImageSource contains tbm_surface_h or is empty * @return A smart-pointer to a newly allocated image. */ - static NativeImageSourceTizen* New(unsigned int width, - unsigned int height, - Dali::NativeImageSource::ColorDepth depth, - Any nativeImageSource); + static NativeImageSourceTizen* New(uint32_t width, + uint32_t height, + Dali::NativeImageSource::ColorDepth depth, + Any nativeImageSource); /** * @copydoc Dali::NativeImageSource::GetNativeImageSource() @@ -67,22 +64,17 @@ public: /** * @copydoc Dali::NativeImageSource::GetPixels() */ - bool GetPixels(std::vector &pixbuf, unsigned int &width, unsigned int &height, Pixel::Format& pixelFormat ) const override; - - /** - * @copydoc Dali::NativeImageSource::EncodeToFile(const std::string& ) - */ - bool EncodeToFile(const std::string& filename) const override; + bool GetPixels(std::vector& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override; /** * @copydoc Dali::NativeImageSource::SetSource( Any source ) */ - void SetSource( Any source ) override; + void SetSource(Any source) override; /** * @copydoc Dali::NativeImageSource::IsColorDepthSupported( ColorDepth colorDepth ) */ - bool IsColorDepthSupported( Dali::NativeImageSource::ColorDepth colorDepth ) override; + bool IsColorDepthSupported(Dali::NativeImageSource::ColorDepth colorDepth) override; /** * destructor @@ -90,19 +82,19 @@ public: ~NativeImageSourceTizen() override; /** - * @copydoc Dali::NativeImageSource::GlExtensionCreate() + * @copydoc Dali::NativeImageSource::CreateResource() */ - bool GlExtensionCreate() override; + bool CreateResource() override; /** - * @copydoc Dali::NativeImageSource::GlExtensionDestroy() + * @copydoc Dali::NativeImageSource::DestroyResource() */ - void GlExtensionDestroy() override; + void DestroyResource() override; /** * @copydoc Dali::NativeImageSource::TargetTexture() */ - unsigned int TargetTexture() override; + uint32_t TargetTexture() override; /** * @copydoc Dali::NativeImageSource::PrepareTexture() @@ -112,7 +104,7 @@ public: /** * @copydoc Dali::NativeImageSource::GetWidth() */ - unsigned int GetWidth() const override + uint32_t GetWidth() const override { return mWidth; } @@ -120,7 +112,7 @@ public: /** * @copydoc Dali::NativeImageSource::GetHeight() */ - unsigned int GetHeight() const override + uint32_t GetHeight() const override { return mHeight; } @@ -134,30 +126,49 @@ public: } /** + * @copydoc Dali::NativeImageInterface::GetCustomFragmentPrefix() + */ + const char* GetCustomFragmentPrefix() const override; + + /** + * @copydoc Dali::NativeImageInterface::GetCustomSamplerTypename() + */ + const char* GetCustomSamplerTypename() const override; + + /** + * @copydoc Dali::NativeImageInterface::GetTextureTarget() + */ + int GetTextureTarget() const override; + + /** + * @copydoc Dali::NativeImageInterface::GetNativeImageHandle() + */ + Any GetNativeImageHandle() const override; + + /** + * @copydoc Dali::NativeImageInterface::SourceChanged() + */ + bool SourceChanged() const override; + + /** * @copydoc Dali::NativeImageInterface::GetExtension() */ NativeImageInterface::Extension* GetNativeImageInterfaceExtension() override { - return this; + return nullptr; } /** - * @copydoc Dali::NativeImageInterface::Extension::GetCustomFragmentPreFix() - */ - const char* GetCustomFragmentPreFix() override; - - /** - * @copydoc Dali::NativeImageInterface::Extension::GetCustomSamplerTypename() + * @copydoc Dali::Internal::Adaptor::NativeImageSource::AcquireBuffer() */ - const char* GetCustomSamplerTypename() override; + uint8_t* AcquireBuffer(uint16_t& width, uint16_t& height, uint16_t& stride) override; /** - * @copydoc Dali::NativeImageInterface::Extension::GetEglImageTextureTarget() + * @copydoc Dali::Internal::Adaptor::NativeImageSource::ReleaseBuffer() */ - int GetEglImageTextureTarget() override; + bool ReleaseBuffer() override; private: - /** * Private constructor; @see NativeImageSource::New() * @param[in] width The width of the image. @@ -165,31 +176,33 @@ private: * @param[in] colour depth of the image. * @param[in] nativeImageSource contains either: pixmap of type X11 Pixmap , a Ecore_X_Pixmap or is empty */ - NativeImageSourceTizen(unsigned int width, - unsigned int height, - Dali::NativeImageSource::ColorDepth depth, - Any nativeImageSource); + NativeImageSourceTizen(uint32_t width, + unsigned int height, + Dali::NativeImageSource::ColorDepth depth, + Any nativeImageSource); void Initialize(); - int GetPixelDepth(Dali::NativeImageSource::ColorDepth depth) const; + tbm_surface_h GetSurfaceFromAny(Any source) const; - tbm_surface_h GetSurfaceFromAny( Any source ) const; + bool CheckBlending(tbm_format format); - bool CheckBlending( tbm_format format ); + void DestroySurface(); private: - - unsigned int mWidth; ///< image width - unsigned int mHeight; ///< image heights - bool mOwnTbmSurface; ///< Whether we created pixmap or not - tbm_surface_h mTbmSurface; - tbm_format mTbmFormat; - bool mBlendingRequired; ///< Whether blending is required - Dali::NativeImageSource::ColorDepth mColorDepth; ///< color depth of image - void* mEglImageKHR; ///< From EGL extension - EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions - bool mSetSource; + uint32_t mWidth; ///< image width + uint32_t mHeight; ///< image height + bool mOwnTbmSurface; ///< Whether we created pixmap or not + tbm_surface_h mTbmSurface; + tbm_format mTbmFormat; + bool mBlendingRequired; ///< Whether blending is required + Dali::NativeImageSource::ColorDepth mColorDepth; ///< color depth of image + void* mEglImageKHR; ///< From EGL extension + EglGraphics* mEglGraphics; ///< EGL Graphics + EglImageExtensions* mEglImageExtensions; ///< The EGL Image Extensions + bool mSetSource; + mutable Dali::Mutex mMutex; + bool mIsBufferAcquired; ///< Whether AcquireBuffer is called }; } // namespace Adaptor