Add stride to PixelData
[platform/core/uifw/dali-core.git] / dali / internal / event / images / pixel-data-impl.cpp
index 37c6bc2..622f867 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
 
 namespace Dali
 {
-
 namespace Internal
 {
-
-PixelData::PixelData( uint8_t* buffer,
-                      uint32_t bufferSize,
-                      uint32_t width,
-                      uint32_t height,
-                      Pixel::Format pixelFormat,
-                      Dali::PixelData::ReleaseFunction releaseFunction )
-: mBuffer( buffer ),
-  mBufferSize( bufferSize ),
-  mWidth( width ),
-  mHeight( height ),
-  mPixelFormat( pixelFormat ),
-  mReleaseFunction( releaseFunction )
+PixelData::PixelData(uint8_t*                         buffer,
+                     uint32_t                         bufferSize,
+                     uint32_t                         width,
+                     uint32_t                         height,
+                     uint32_t                         stride,
+                     Pixel::Format                    pixelFormat,
+                     Dali::PixelData::ReleaseFunction releaseFunction)
+: mBuffer(buffer),
+  mBufferSize(bufferSize),
+  mWidth(width),
+  mHeight(height),
+  mStride(stride),
+  mPixelFormat(pixelFormat),
+  mReleaseFunction(releaseFunction)
 {
 }
 
 PixelData::~PixelData()
 {
-  if( mBuffer )
+  if(mBuffer)
   {
-    if( mReleaseFunction == Dali::PixelData::FREE )
+    if(mReleaseFunction == Dali::PixelData::FREE)
     {
-      free( mBuffer );
+      free(mBuffer);
     }
     else
     {
       delete[] mBuffer;
     }
   }
- }
+}
 
-PixelDataPtr PixelData::New( uint8_t* buffer,
-                             uint32_t bufferSize,
-                             uint32_t width,
-                             uint32_t height,
-                             Pixel::Format pixelFormat,
-                             Dali::PixelData::ReleaseFunction releaseFunction )
+PixelDataPtr PixelData::New(uint8_t*                         buffer,
+                            uint32_t                         bufferSize,
+                            uint32_t                         width,
+                            uint32_t                         height,
+                            uint32_t                         stride,
+                            Pixel::Format                    pixelFormat,
+                            Dali::PixelData::ReleaseFunction releaseFunction)
 {
-  return new PixelData( buffer, bufferSize, width, height, pixelFormat, releaseFunction );
+  return new PixelData(buffer, bufferSize, width, height, stride, pixelFormat, releaseFunction);
 }
 
 uint32_t PixelData::GetWidth() const
@@ -96,7 +97,11 @@ DevelPixelData::PixelDataBuffer PixelData::ReleaseBuffer()
   return pixelDataBuffer;
 }
 
+uint32_t PixelData::GetStride() const
+{
+  return mStride;
+}
 
-}// namespace Internal
+} // namespace Internal
 
-}// namespace Dali
+} // namespace Dali