[dali_2.3.34] Merge branch 'devel/master'
[platform/core/uifw/dali-adaptor.git] / dali / internal / imaging / common / pixel-buffer-impl.h
index 0866dd4..d9898bf 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_ADAPTOR_PIXEL_BUFFER_H
 
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -20,6 +20,7 @@
 
 // INTERNAL INCLUDES
 #include <dali/devel-api/adaptor-framework/pixel-buffer.h>
+#include <dali/integration-api/debug.h>
 #include <dali/public-api/images/image-operations.h> // For ImageDimensions
 #include <dali/public-api/images/pixel-data.h>
 #include <dali/public-api/object/base-object.h>
@@ -75,9 +76,10 @@ public:
    * The new object takes ownership of the buffer data, and the
    * mBuffer pointer is reset to NULL.
    * @param[in] pixelBuffer The buffer to convert
+   * @param[in] releaseAfterUpload Whether converted PixelData released after upload or not.
    * @return the pixelData
    */
-  static Dali::PixelData Convert(PixelBuffer& pixelBuffer);
+  static Dali::PixelData Convert(PixelBuffer& pixelBuffer, bool releaseAfterUpload);
 
   /**
    * @brief Constructor.
@@ -106,6 +108,18 @@ protected:
 
 public:
   /**
+   * Get the total allocated size of current pixel buffers
+   */
+  static uint32_t GetTotalAllocatedSize()
+  {
+#if defined(DEBUG_ENABLED)
+    return gPixelBufferAllocationTotal;
+#else
+    return 0;
+#endif
+  }
+
+  /**
    * Get the width of the buffer in pixels.
    * @return The width of the buffer in pixels
    */
@@ -297,6 +311,10 @@ private:
   uint32_t                       mStride;        ///< Buffer stride in bytes, 0 means the buffer is tightly packed
   Pixel::Format                  mPixelFormat;   ///< Pixel format
   bool                           mPreMultiplied; ///< PreMultiplied
+
+#if defined(DEBUG_ENABLED)
+  static uint32_t gPixelBufferAllocationTotal;
+#endif
 };
 
 } // namespace Adaptor