[dali_2.3.42] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / internal / imaging / windows / native-image-source-impl-win.h
index e17503e..88059d6 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
@@ -22,6 +22,7 @@
 #include <dali/public-api/adaptor-framework/native-image-source.h>
 
 #include <dali/internal/imaging/common/native-image-source-impl.h>
+#include <cstdint>
 
 namespace Dali
 {
@@ -29,6 +30,7 @@ namespace Internal
 {
 namespace Adaptor
 {
+class EglGraphics;
 class EglImageExtensions;
 
 /**
@@ -46,8 +48,8 @@ public:
    * @param[in] nativeImageSource contains either: pixmap of type Win32 Pixmap , a WinPixmap or is empty
    * @return A smart-pointer to a newly allocated image.
    */
-  static NativeImageSourceWin* New(unsigned int                        width,
-                                   unsigned int                        height,
+  static NativeImageSourceWin* New(uint32_t                            width,
+                                   uint32_t                            height,
                                    Dali::NativeImageSource::ColorDepth depth,
                                    Any                                 nativeImageSource);
   /**
@@ -58,7 +60,7 @@ public:
   /**
    * @copydoc Dali::NativeImageSource::GetPixels()
    */
-  bool GetPixels(std::vector<unsigned char>& pixbuf, unsigned int& width, unsigned int& height, Pixel::Format& pixelFormat) const override;
+  bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
 
   /**
    * @copydoc Dali::NativeImageSource::SetSource( Any source )
@@ -88,7 +90,7 @@ public:
   /**
    * @copydoc Dali::NativeImageSource::TargetTexture()
    */
-  unsigned int TargetTexture() override;
+  uint32_t TargetTexture() override;
 
   /**
    * @copydoc Dali::NativeImageSource::PrepareTexture()
@@ -98,7 +100,7 @@ public:
   /**
    * @copydoc Dali::NativeImageSource::GetWidth()
    */
-  unsigned int GetWidth() const override
+  uint32_t GetWidth() const override
   {
     return mWidth;
   }
@@ -106,7 +108,7 @@ public:
   /**
    * @copydoc Dali::NativeImageSource::GetHeight()
    */
-  unsigned int GetHeight() const override
+  uint32_t GetHeight() const override
   {
     return mHeight;
   }
@@ -120,9 +122,9 @@ public:
   }
 
   /**
-   * @copydoc Dali::NativeImageInterface::GetCustomFragmentPrefix()
+   * @copydoc Dali::NativeImageInterface::ApplyNativeFragmentShader()
    */
-  const char* GetCustomFragmentPrefix() const override;
+  bool ApplyNativeFragmentShader(std::string& shader) override;
 
   /**
    * @copydoc Dali::NativeImageInterface::GetCustomSamplerTypename()
@@ -145,6 +147,14 @@ public:
   bool SourceChanged() const override;
 
   /**
+   * @copydoc Dali::NativeImageInterface::GetUpdatedArea()
+   */
+  Rect<uint32_t> GetUpdatedArea() override
+  {
+    return Rect<uint32_t>{0, 0, mWidth, mHeight};
+  }
+
+  /**
    * @copydoc Dali::NativeImageInterface::GetExtension()
    */
   NativeImageInterface::Extension* GetNativeImageInterfaceExtension() override
@@ -155,12 +165,22 @@ public:
   /**
    * @copydoc Dali::Internal::Adaptor::NativeImageSource::AcquireBuffer()
    */
-  uint8_t* AcquireBuffer(uint16_t& width, uint16_t& height, uint16_t& stride) override;
+  uint8_t* AcquireBuffer(uint32_t& width, uint32_t& height, uint32_t& stride) override;
 
   /**
    * @copydoc Dali::Internal::Adaptor::NativeImageSource::ReleaseBuffer()
    */
-  bool ReleaseBuffer() override;
+  bool ReleaseBuffer(const Rect<uint32_t>& updatedArea) override;
+
+  /**
+   * @copydoc Dali::NativeImageSource::SetResourceDestructionCallback()
+   */
+  void SetResourceDestructionCallback(EventThreadCallback* callback) override;
+
+  /**
+   * @copydoc Dali::DevelNativeImageSource::EnableBackBuffer()
+   */
+  void EnableBackBuffer(bool enable) override;
 
 private:
   /**
@@ -170,8 +190,8 @@ private:
    * @param[in] colour depth of the image.
    * @param[in] nativeImageSource contains either: pixmap of type Win32 Pixmap , a WinPixmap or is empty
    */
-  NativeImageSourceWin(unsigned int                        width,
-                       unsigned int                        height,
+  NativeImageSourceWin(uint32_t                            width,
+                       uint32_t                            height,
                        Dali::NativeImageSource::ColorDepth depth,
                        Any                                 nativeImageSource);
 
@@ -201,14 +221,16 @@ private:
   void GetPixmapDetails();
 
 private:
-  unsigned int                        mWidth;              ///< image width
-  unsigned int                        mHeight;             ///< image heights
-  bool                                mOwnPixmap;          ///< Whether we created pixmap or not
-  unsigned int                        mPixmap;             ///< From Windows
-  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
+  uint32_t                             mWidth;                       ///< image width
+  uint32_t                             mHeight;                      ///< image heights
+  bool                                 mOwnPixmap;                   ///< Whether we created pixmap or not
+  unsigned int                         mPixmap;                      ///< From Windows
+  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
+  std::unique_ptr<EventThreadCallback> mResourceDestructionCallback; ///< The Resource Destruction Callback
 };
 
 } // namespace Adaptor