Fix build error of native-image-source-impl
[platform/core/uifw/dali-adaptor.git] / dali / internal / imaging / tizen / native-image-source-impl-tizen.h
old mode 100755 (executable)
new mode 100644 (file)
index d40142c..35299ba
@@ -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.
  */
 
 // EXTERNAL INCLUDES
-#include <tbm_surface.h>
-#include <dali/devel-api/images/native-image-interface-extension.h>
 #include <dali/devel-api/threading/mutex.h>
 #include <dali/public-api/common/dali-vector.h>
+#include <tbm_surface.h>
+#include <memory>
 
 // INTERNAL INCLUDES
-#include <dali/public-api/adaptor-framework/native-image-source.h>
 #include <dali/internal/imaging/common/native-image-source-impl.h>
+#include <dali/public-api/adaptor-framework/native-image-source.h>
 
 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.
@@ -56,10 +52,10 @@ public:
    * @param[in] nativeImageSource contains tbm_surface_h or is empty
    * @return A smart-pointer to a newly allocated image.
    */
-  static NativeImageSourceTizen* New(uint32_t width,
-                          uint32_t 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()
@@ -69,22 +65,17 @@ public:
   /**
    * @copydoc Dali::NativeImageSource::GetPixels()
    */
-  bool GetPixels(std::vector<unsigned char> &pixbuf, uint32_t &width, uint32_t &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<unsigned char>& 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
@@ -92,14 +83,14 @@ 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()
@@ -136,40 +127,54 @@ public:
   }
 
   /**
-   * @copydoc Dali::NativeImageInterface::GetExtension()
+   * @copydoc Dali::NativeImageInterface::ApplyNativeFragmentShader(std::string& shader)
    */
-  NativeImageInterface::Extension* GetNativeImageInterfaceExtension() override
-  {
-    return this;
-  }
+  bool ApplyNativeFragmentShader(std::string& shader) override;
 
   /**
-   * @copydoc Dali::NativeImageInterface::Extension::GetCustomFragmentPreFix()
+   * @copydoc Dali::NativeImageInterface::GetCustomSamplerTypename()
    */
-  const char* GetCustomFragmentPreFix() override;
+  const char* GetCustomSamplerTypename() const override;
 
   /**
-   * @copydoc Dali::NativeImageInterface::Extension::GetCustomSamplerTypename()
+   * @copydoc Dali::NativeImageInterface::GetTextureTarget()
    */
-  const char* GetCustomSamplerTypename() override;
+  int GetTextureTarget() const override;
 
   /**
-   * @copydoc Dali::NativeImageInterface::Extension::GetEglImageTextureTarget()
+   * @copydoc Dali::NativeImageInterface::GetNativeImageHandle()
    */
-  int GetEglImageTextureTarget() override;
+  Any GetNativeImageHandle() const override;
+
+  /**
+   * @copydoc Dali::NativeImageInterface::SourceChanged()
+   */
+  bool SourceChanged() const override;
+
+  /**
+   * @copydoc Dali::NativeImageInterface::GetExtension()
+   */
+  NativeImageInterface::Extension* GetNativeImageInterfaceExtension() override
+  {
+    return nullptr;
+  }
 
   /**
    * @copydoc Dali::Internal::Adaptor::NativeImageSource::AcquireBuffer()
    */
-  uint8_t* AcquireBuffer( uint16_t& width, uint16_t& height, uint16_t& stride ) override;
+  uint8_t* AcquireBuffer(uint16_t& width, uint16_t& height, uint16_t& stride) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::NativeImageSource::ReleaseBuffer()
    */
   bool ReleaseBuffer() override;
 
-private:
+  /**
+   * @copydoc Dali::NativeImageSource::SetResourceDestructionCallback()
+   */
+  void SetResourceDestructionCallback(EventThreadCallback* callback) override;
 
+private:
   /**
    * Private constructor; @see NativeImageSource::New()
    * @param[in] width The width of the image.
@@ -177,34 +182,34 @@ 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(uint32_t 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();
 
-  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:
-
-  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
+  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
+  std::unique_ptr<EventThreadCallback> mResourceDestructionCallback;  ///< The Resource Destruction Callback
 };
 
 } // namespace Adaptor