From fab9282118c3d1fca15c0d93134855e1c2bbafa3 Mon Sep 17 00:00:00 2001 From: Eunki Hong Date: Wed, 20 Sep 2023 03:46:54 +0900 Subject: [PATCH] Make NativeImageSource.GetWidth() GetHeight() as public And also, make minor fix-up that unsigned int --> uint32_t Change-Id: I3308d664ca7e0d1f0241083aa1b245440c8aa055 Signed-off-by: Eunki Hong --- .../android/native-image-source-impl-android.cpp | 8 +++--- .../android/native-image-source-impl-android.h | 2 +- .../imaging/common/native-bitmap-buffer-impl.cpp | 12 ++++---- .../imaging/common/native-bitmap-buffer-impl.h | 16 +++++------ .../imaging/common/native-image-source-impl.h | 2 +- .../macos/native-image-source-factory-mac.cpp | 8 +++--- .../macos/native-image-source-factory-mac.h | 8 +++--- .../imaging/macos/native-image-source-impl-mac.cpp | 26 +++++++++--------- .../imaging/macos/native-image-source-impl-mac.h | 22 +++++++-------- .../tizen/native-image-source-impl-tizen.cpp | 32 +++++++++++----------- .../imaging/tizen/native-image-source-impl-tizen.h | 2 +- .../tizen/native-image-source-queue-impl-tizen.cpp | 2 +- .../tizen/native-image-source-queue-impl-tizen.h | 4 +-- .../ubuntu-x11/native-image-source-impl-x.cpp | 24 ++++++++-------- .../ubuntu-x11/native-image-source-impl-x.h | 2 +- .../windows/native-image-source-factory-win.cpp | 4 +-- .../windows/native-image-source-factory-win.h | 4 +-- .../windows/native-image-source-impl-win.cpp | 10 +++---- .../imaging/windows/native-image-source-impl-win.h | 21 +++++++------- .../adaptor-framework/native-image-source.cpp | 12 ++++---- .../adaptor-framework/native-image-source.h | 29 ++++++++++---------- 21 files changed, 126 insertions(+), 124 deletions(-) diff --git a/dali/internal/imaging/android/native-image-source-impl-android.cpp b/dali/internal/imaging/android/native-image-source-impl-android.cpp index 1b25af1..96a9f4f 100644 --- a/dali/internal/imaging/android/native-image-source-impl-android.cpp +++ b/dali/internal/imaging/android/native-image-source-impl-android.cpp @@ -132,9 +132,9 @@ Any NativeImageSourceAndroid::GetNativeImageSource() const return Any(mPixmap); } -bool NativeImageSourceAndroid::GetPixels(std::vector& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const +bool NativeImageSourceAndroid::GetPixels(std::vector& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const { - DALI_ASSERT_DEBUG(sizeof(unsigned) == 4); + DALI_ASSERT_DEBUG(sizeof(uint32_t) == 4); bool success = false; width = mWidth; @@ -182,8 +182,8 @@ bool NativeImageSourceAndroid::GetPixels(std::vector& pixbuf, uns uint32_t size = dstStride * bufferDescription.height; pixbuf.resize(size); //copy each row over - const unsigned char* ptrSrc = reinterpret_cast(buffer); - unsigned char* ptrDst = pixbuf.data(); + const uint8_t* ptrSrc = reinterpret_cast(buffer); + uint8_t* ptrDst = pixbuf.data(); for(int y = 0; y < bufferDescription.height; y++, ptrSrc += srcStride, ptrDst += dstStride) { memcpy(ptrDst, ptrSrc, dstStride); diff --git a/dali/internal/imaging/android/native-image-source-impl-android.h b/dali/internal/imaging/android/native-image-source-impl-android.h index d735456..3da39a8 100644 --- a/dali/internal/imaging/android/native-image-source-impl-android.h +++ b/dali/internal/imaging/android/native-image-source-impl-android.h @@ -64,7 +64,7 @@ public: /** * @copydoc Dali::NativeImageSource::GetPixels() */ - bool GetPixels(std::vector& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override; + bool GetPixels(std::vector& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override; /** * @copydoc Dali::NativeImageSource::SetSource( Any source ) diff --git a/dali/internal/imaging/common/native-bitmap-buffer-impl.cpp b/dali/internal/imaging/common/native-bitmap-buffer-impl.cpp index cc7051b..3e7d7c0 100644 --- a/dali/internal/imaging/common/native-bitmap-buffer-impl.cpp +++ b/dali/internal/imaging/common/native-bitmap-buffer-impl.cpp @@ -32,7 +32,7 @@ namespace Internal { namespace Adaptor { -NativeBitmapBuffer::NativeBitmapBuffer(Adaptor* adaptor, unsigned int width, unsigned int height, Pixel::Format pFormat) +NativeBitmapBuffer::NativeBitmapBuffer(Adaptor* adaptor, uint32_t width, uint32_t height, Pixel::Format pFormat) : mGlAbstraction(nullptr), mWidth(width), mHeight(height), @@ -60,7 +60,7 @@ void NativeBitmapBuffer::PrepareTexture() Integration::ConvertToGlFormat(mPixelFormat, pixelDataType, pixelFormat); - const unsigned char* buf = mBuffer->Read(); + const uint8_t* buf = mBuffer->Read(); if(buf && buf != mLastReadBuffer) // Prevent same buffer being uploaded multiple times { @@ -71,7 +71,7 @@ void NativeBitmapBuffer::PrepareTexture() } } -void NativeBitmapBuffer::Write(const unsigned char* src, size_t size) +void NativeBitmapBuffer::Write(const uint8_t* src, size_t size) { mBuffer->Write(src, size); // Write will cause LocklessBuffer to switch to the other buffer } @@ -85,17 +85,17 @@ void NativeBitmapBuffer::DestroyResource() { } -unsigned int NativeBitmapBuffer::TargetTexture() +uint32_t NativeBitmapBuffer::TargetTexture() { return 0; } -unsigned int NativeBitmapBuffer::GetWidth() const +uint32_t NativeBitmapBuffer::GetWidth() const { return mWidth; } -unsigned int NativeBitmapBuffer::GetHeight() const +uint32_t NativeBitmapBuffer::GetHeight() const { return mHeight; } diff --git a/dali/internal/imaging/common/native-bitmap-buffer-impl.h b/dali/internal/imaging/common/native-bitmap-buffer-impl.h index 64122cc..aa8f632 100644 --- a/dali/internal/imaging/common/native-bitmap-buffer-impl.h +++ b/dali/internal/imaging/common/native-bitmap-buffer-impl.h @@ -51,7 +51,7 @@ public: * @param height height of image * @param pixelFormat pixel format for image */ - NativeBitmapBuffer(Adaptor* adaptor, unsigned int width, unsigned int height, Pixel::Format pixelFormat); + NativeBitmapBuffer(Adaptor* adaptor, uint32_t width, uint32_t height, Pixel::Format pixelFormat); /** * virtual destructor @@ -64,7 +64,7 @@ public: * @param[in] size size of data in bytes * @return true if successful, false if currently reading from buffer in render thread */ - void Write(const unsigned char* src, size_t size); + void Write(const uint8_t* src, size_t size); public: /** @@ -80,7 +80,7 @@ public: /** * @copydoc Dali::NativeImageInterface::TargetTexture() */ - unsigned int TargetTexture() override; + uint32_t TargetTexture() override; /** * @copydoc Dali::NativeImageInterface::PrepareTexture() @@ -90,12 +90,12 @@ public: /** * @copydoc Dali::NativeImageInterface::GetWidth() */ - unsigned int GetWidth() const override; + uint32_t GetWidth() const override; /** * @copydoc Dali::NativeImageInterface::GetHeight() */ - unsigned int GetHeight() const override; + uint32_t GetHeight() const override; /** * @copydoc Dali::NativeImageInterface::RequiresBlending() @@ -144,10 +144,10 @@ private: Integration::GlAbstraction* mGlAbstraction; ///< GlAbstraction used Integration::LocklessBuffer* mBuffer; ///< bitmap data double buffered - unsigned int mWidth; ///< Image width - unsigned int mHeight; ///< Image height + uint32_t mWidth; ///< Image width + uint32_t mHeight; ///< Image height Pixel::Format mPixelFormat; ///< Image pixelformat - const unsigned char* mLastReadBuffer; ///< last buffer that was read + const uint8_t* mLastReadBuffer; ///< last buffer that was read }; } // namespace Adaptor diff --git a/dali/internal/imaging/common/native-image-source-impl.h b/dali/internal/imaging/common/native-image-source-impl.h index d990c62..6b90eb8 100644 --- a/dali/internal/imaging/common/native-image-source-impl.h +++ b/dali/internal/imaging/common/native-image-source-impl.h @@ -58,7 +58,7 @@ public: /** * @copydoc Dali::NativeImageSource::GetPixels() */ - virtual bool GetPixels(std::vector& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const = 0; + virtual bool GetPixels(std::vector& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const = 0; /** * @copydoc Dali::NativeImageSource::SetSource( Any source ) diff --git a/dali/internal/imaging/macos/native-image-source-factory-mac.cpp b/dali/internal/imaging/macos/native-image-source-factory-mac.cpp index 04182e9..6584e98 100644 --- a/dali/internal/imaging/macos/native-image-source-factory-mac.cpp +++ b/dali/internal/imaging/macos/native-image-source-factory-mac.cpp @@ -26,8 +26,8 @@ namespace Dali::Internal::Adaptor { std::unique_ptr NativeImageSourceFactoryCocoa::CreateNativeImageSource( - unsigned int width, - unsigned int height, + uint32_t width, + uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) { @@ -40,8 +40,8 @@ NativeImageSourceFactoryCocoa::CreateNativeImageSource( std::unique_ptr NativeImageSourceFactoryCocoa::CreateNativeImageSourceQueue( - unsigned int width, - unsigned int height, + uint32_t width, + uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) { diff --git a/dali/internal/imaging/macos/native-image-source-factory-mac.h b/dali/internal/imaging/macos/native-image-source-factory-mac.h index afb0d89..d78de43 100644 --- a/dali/internal/imaging/macos/native-image-source-factory-mac.h +++ b/dali/internal/imaging/macos/native-image-source-factory-mac.h @@ -26,14 +26,14 @@ class NativeImageSourceFactoryCocoa : public NativeImageSourceFactory { public: std::unique_ptr CreateNativeImageSource( - unsigned int width, - unsigned int height, + uint32_t width, + uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) override; std::unique_ptr CreateNativeImageSourceQueue( - unsigned int width, - unsigned int height, + uint32_t width, + uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) override; }; diff --git a/dali/internal/imaging/macos/native-image-source-impl-mac.cpp b/dali/internal/imaging/macos/native-image-source-impl-mac.cpp index f6ad654..21a9931 100644 --- a/dali/internal/imaging/macos/native-image-source-impl-mac.cpp +++ b/dali/internal/imaging/macos/native-image-source-impl-mac.cpp @@ -32,8 +32,8 @@ namespace Dali::Internal::Adaptor using Dali::Integration::PixelBuffer; NativeImageSourceCocoa* NativeImageSourceCocoa::New( - unsigned int width, - unsigned int height, + uint32_t width, + uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) { @@ -41,8 +41,8 @@ NativeImageSourceCocoa* NativeImageSourceCocoa::New( } NativeImageSourceCocoa::NativeImageSourceCocoa( - unsigned int width, - unsigned int height, + uint32_t width, + uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) : mImage(MakeRef(nullptr)), @@ -119,12 +119,12 @@ Any NativeImageSourceCocoa::GetNativeImageSource() const bool NativeImageSourceCocoa::GetPixels( std::vector& pixbuf, - unsigned& width, - unsigned& height, + uint32_t& width, + uint32_t& height, Pixel::Format& pixelFormat) const { - width = CGImageGetWidth(mImage.get()); - height = CGImageGetHeight(mImage.get()); + width = static_cast(CGImageGetWidth(mImage.get())); + height = static_cast(CGImageGetHeight(mImage.get())); return true; } @@ -146,7 +146,7 @@ void NativeImageSourceCocoa::DestroyResource() { } -unsigned int NativeImageSourceCocoa::TargetTexture() +uint32_t NativeImageSourceCocoa::TargetTexture() { return 0; } @@ -175,14 +175,14 @@ Any NativeImageSourceCocoa::GetNativeImageHandle() const return Any(mImage.get()); } -unsigned int NativeImageSourceCocoa::GetWidth() const +uint32_t NativeImageSourceCocoa::GetWidth() const { - return CGImageGetWidth(mImage.get()); + return static_cast(CGImageGetWidth(mImage.get())); } -unsigned int NativeImageSourceCocoa::GetHeight() const +uint32_t NativeImageSourceCocoa::GetHeight() const { - return CGImageGetHeight(mImage.get()); + return static_cast(CGImageGetHeight(mImage.get())); } bool NativeImageSourceCocoa::RequiresBlending() const diff --git a/dali/internal/imaging/macos/native-image-source-impl-mac.h b/dali/internal/imaging/macos/native-image-source-impl-mac.h index 100fa74..864e3f9 100644 --- a/dali/internal/imaging/macos/native-image-source-impl-mac.h +++ b/dali/internal/imaging/macos/native-image-source-impl-mac.h @@ -44,8 +44,8 @@ public: * @return A smart-pointer to a newly allocated image. */ static NativeImageSourceCocoa* New( - unsigned int width, - unsigned int height, + uint32_t width, + uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource); @@ -58,10 +58,10 @@ public: * @copydoc Dali::NativeImageSource::GetPixels() */ bool GetPixels( - std::vector& pixbuf, - unsigned int& width, - unsigned int& height, - Pixel::Format& pixelFormat) const override; + std::vector& pixbuf, + uint32_t& width, + uint32_t& height, + Pixel::Format& pixelFormat) const override; /** * @copydoc Dali::NativeImageSource::SetSource( Any source ) @@ -91,7 +91,7 @@ public: /** * @copydoc Dali::NativeImageSource::TargetTexture() */ - unsigned int TargetTexture() override; + uint32_t TargetTexture() override; /** * @copydoc Dali::NativeImageSource::PrepareTexture() @@ -101,12 +101,12 @@ public: /** * @copydoc Dali::NativeImageSource::GetWidth() */ - unsigned int GetWidth() const override; + uint32_t GetWidth() const override; /** * @copydoc Dali::NativeImageSource::GetHeight() */ - unsigned int GetHeight() const override; + uint32_t GetHeight() const override; /** * @copydoc Dali::NativeImageSource::RequiresBlending() @@ -183,8 +183,8 @@ private: * @param[in] nativeImageSource contains either: pixmap of type Win32 Pixmap , a WinPixmap or is empty */ NativeImageSourceCocoa( - unsigned int width, - unsigned int height, + uint32_t width, + uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource); diff --git a/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp b/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp index e5936b3..93d2861 100644 --- a/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp +++ b/dali/internal/imaging/tizen/native-image-source-impl-tizen.cpp @@ -220,7 +220,7 @@ Any NativeImageSourceTizen::GetNativeImageSource() const return Any(mTbmSurface); } -bool NativeImageSourceTizen::GetPixels(std::vector& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const +bool NativeImageSourceTizen::GetPixels(std::vector& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const { std::scoped_lock lock(mMutex); if(mTbmSurface != NULL) @@ -237,9 +237,9 @@ bool NativeImageSourceTizen::GetPixels(std::vector& pixbuf, unsig return false; } - tbm_format format = surface_info.format; - uint32_t stride = surface_info.planes[0].stride; - unsigned char* ptr = surface_info.planes[0].ptr; + tbm_format format = surface_info.format; + uint32_t stride = surface_info.planes[0].stride; + uint8_t* ptr = surface_info.planes[0].ptr; width = mWidth; height = mHeight; @@ -254,11 +254,11 @@ bool NativeImageSourceTizen::GetPixels(std::vector& pixbuf, unsig lineSize = width * 3; pixelFormat = Pixel::RGB888; pixbuf.resize(lineSize * height); - unsigned char* bufptr = &pixbuf[0]; + uint8_t* bufptr = &pixbuf[0]; - for(unsigned int r = 0; r < height; ++r, bufptr += lineSize) + for(uint32_t r = 0; r < height; ++r, bufptr += lineSize) { - for(unsigned int c = 0; c < width; ++c) + for(uint32_t c = 0; c < width; ++c) { cOffset = c * 3; offset = cOffset + r * stride; @@ -274,11 +274,11 @@ bool NativeImageSourceTizen::GetPixels(std::vector& pixbuf, unsig lineSize = width * 4; pixelFormat = Pixel::RGBA8888; pixbuf.resize(lineSize * height); - unsigned char* bufptr = &pixbuf[0]; + uint8_t* bufptr = &pixbuf[0]; - for(unsigned int r = 0; r < height; ++r, bufptr += lineSize) + for(uint32_t r = 0; r < height; ++r, bufptr += lineSize) { - for(unsigned int c = 0; c < width; ++c) + for(uint32_t c = 0; c < width; ++c) { cOffset = c * 4; offset = cOffset + r * stride; @@ -295,11 +295,11 @@ bool NativeImageSourceTizen::GetPixels(std::vector& pixbuf, unsig lineSize = width * 4; pixelFormat = Pixel::RGBA8888; pixbuf.resize(lineSize * height); - unsigned char* bufptr = &pixbuf[0]; + uint8_t* bufptr = &pixbuf[0]; - for(unsigned int r = 0; r < height; ++r, bufptr += lineSize) + for(uint32_t r = 0; r < height; ++r, bufptr += lineSize) { - for(unsigned int c = 0; c < width; ++c) + for(uint32_t c = 0; c < width; ++c) { cOffset = c * 4; offset = cOffset + r * stride; @@ -397,7 +397,7 @@ bool NativeImageSourceTizen::IsColorDepthSupported(Dali::NativeImageSource::Colo if(tbm_surface_query_formats(&formats, &formatNum)) { - for(unsigned int i = 0; i < formatNum; i++) + for(uint32_t i = 0; i < formatNum; i++) { if(formats[i] == format) { @@ -534,8 +534,8 @@ Rect NativeImageSourceTizen::GetUpdatedArea() return updatedArea; } - unsigned char* srcBuffer = info.planes[0].ptr; - unsigned char* dstBuffer = backBufferInfo.planes[0].ptr; + uint8_t* srcBuffer = info.planes[0].ptr; + uint8_t* dstBuffer = backBufferInfo.planes[0].ptr; uint32_t stride = info.planes[0].stride; uint32_t bytesPerPixel = info.bpp >> 3; diff --git a/dali/internal/imaging/tizen/native-image-source-impl-tizen.h b/dali/internal/imaging/tizen/native-image-source-impl-tizen.h index e2d1881..70f0340 100644 --- a/dali/internal/imaging/tizen/native-image-source-impl-tizen.h +++ b/dali/internal/imaging/tizen/native-image-source-impl-tizen.h @@ -65,7 +65,7 @@ public: /** * @copydoc Dali::NativeImageSource::GetPixels() */ - bool GetPixels(std::vector& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override; + bool GetPixels(std::vector& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override; /** * @copydoc Dali::NativeImageSource::SetSource( Any source ) diff --git a/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp b/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp index 144b826..3cf8ff8 100644 --- a/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp +++ b/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.cpp @@ -266,7 +266,7 @@ uint8_t* NativeImageSourceQueueTizen::DequeueBuffer(uint32_t& width, uint32_t& h return NULL; } - unsigned char* buffer = info.planes[0].ptr; + uint8_t* buffer = info.planes[0].ptr; if(!buffer) { DALI_LOG_ERROR("tbm buffer pointer is null! [%p]\n", tbmSurface); diff --git a/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.h b/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.h index 16dcf9f..cbd5aa7 100644 --- a/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.h +++ b/dali/internal/imaging/tizen/native-image-source-queue-impl-tizen.h @@ -197,8 +197,8 @@ private: bool CheckBlending(int format); private: - typedef std::pair EglImagePair; - typedef std::pair BufferPair; + typedef std::pair EglImagePair; + typedef std::pair BufferPair; Dali::Mutex mMutex; ///< Mutex uint32_t mWidth; ///< image width diff --git a/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp b/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp index 49aeef5..7c86a3e 100644 --- a/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp +++ b/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.cpp @@ -147,9 +147,9 @@ Any NativeImageSourceX::GetNativeImageSource() const return Any(mPixmap); } -bool NativeImageSourceX::GetPixels(std::vector& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const +bool NativeImageSourceX::GetPixels(std::vector& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const { - DALI_ASSERT_DEBUG(sizeof(unsigned) == 4); + DALI_ASSERT_DEBUG(sizeof(uint32_t) == 4); bool success = false; width = mWidth; height = mHeight; @@ -184,18 +184,18 @@ bool NativeImageSourceX::GetPixels(std::vector& pixbuf, unsigned& { pixelFormat = Pixel::RGB888; pixbuf.resize(width * height * 3); - unsigned char* bufPtr = &pixbuf[0]; + uint8_t* bufPtr = &pixbuf[0]; - for(unsigned y = 0; y < height; ++y) + for(uint32_t y = 0; y < height; ++y) { - for(unsigned x = 0; x < width; ++x, bufPtr += 3) + for(uint32_t x = 0; x < width; ++x, bufPtr += 3) { - const unsigned pixel = XGetPixel(pXImage, x, y); + const uint32_t pixel = XGetPixel(pXImage, x, y); // store as RGB - const unsigned blue = pixel & 0xFFU; - const unsigned green = (pixel >> 8) & 0xFFU; - const unsigned red = (pixel >> 16) & 0xFFU; + const uint32_t blue = pixel & 0xFFU; + const uint32_t green = (pixel >> 8) & 0xFFU; + const uint32_t red = (pixel >> 16) & 0xFFU; *bufPtr = red; *(bufPtr + 1) = green; @@ -212,12 +212,12 @@ bool NativeImageSourceX::GetPixels(std::vector& pixbuf, unsigned& // Sweep through the image, doing a vertical flip, but handling each scanline as // an inlined intrinsic/builtin memcpy (should be fast): pixbuf.resize(width * height * 4); - unsigned* bufPtr = reinterpret_cast(&pixbuf[0]); - const unsigned xDataLineSkip = pXImage->bytes_per_line; + uint32_t* bufPtr = reinterpret_cast(&pixbuf[0]); + const uint32_t xDataLineSkip = pXImage->bytes_per_line; const size_t copy_count = static_cast(width) * 4; pixelFormat = Pixel::BGRA8888; - for(unsigned y = 0; y < height; ++y, bufPtr += width) + for(uint32_t y = 0; y < height; ++y, bufPtr += width) { const char* const in = pXImage->data + xDataLineSkip * y; diff --git a/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.h b/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.h index 6890f0e..6745c64 100644 --- a/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.h +++ b/dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.h @@ -62,7 +62,7 @@ public: /** * @copydoc Dali::NativeImageSource::GetPixels() */ - bool GetPixels(std::vector& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override; + bool GetPixels(std::vector& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override; /** * @copydoc Dali::NativeImageSource::SetSource( Any source ) diff --git a/dali/internal/imaging/windows/native-image-source-factory-win.cpp b/dali/internal/imaging/windows/native-image-source-factory-win.cpp index 75746d1..9cd362d 100644 --- a/dali/internal/imaging/windows/native-image-source-factory-win.cpp +++ b/dali/internal/imaging/windows/native-image-source-factory-win.cpp @@ -28,12 +28,12 @@ namespace Internal { namespace Adaptor { -std::unique_ptr NativeImageSourceFactoryWin::CreateNativeImageSource(unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) +std::unique_ptr NativeImageSourceFactoryWin::CreateNativeImageSource(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) { return std::unique_ptr(NativeImageSourceWin::New(width, height, depth, nativeImageSource)); } -std::unique_ptr NativeImageSourceFactoryWin::CreateNativeImageSourceQueue(unsigned int width, unsigned int height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) +std::unique_ptr NativeImageSourceFactoryWin::CreateNativeImageSourceQueue(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) { return std::unique_ptr(nullptr); } diff --git a/dali/internal/imaging/windows/native-image-source-factory-win.h b/dali/internal/imaging/windows/native-image-source-factory-win.h index 05c882f..acae63b 100644 --- a/dali/internal/imaging/windows/native-image-source-factory-win.h +++ b/dali/internal/imaging/windows/native-image-source-factory-win.h @@ -30,9 +30,9 @@ namespace Adaptor class NativeImageSourceFactoryWin : public NativeImageSourceFactory { public: - std::unique_ptr CreateNativeImageSource(unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) override; + std::unique_ptr CreateNativeImageSource(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) override; - std::unique_ptr CreateNativeImageSourceQueue(unsigned int width, unsigned int height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) override; + std::unique_ptr CreateNativeImageSourceQueue(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue) override; }; } // namespace Adaptor diff --git a/dali/internal/imaging/windows/native-image-source-impl-win.cpp b/dali/internal/imaging/windows/native-image-source-impl-win.cpp index 181204e..11a8a87 100644 --- a/dali/internal/imaging/windows/native-image-source-impl-win.cpp +++ b/dali/internal/imaging/windows/native-image-source-impl-win.cpp @@ -36,7 +36,7 @@ namespace Adaptor { using Dali::Integration::PixelBuffer; -NativeImageSourceWin* NativeImageSourceWin::New(unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) +NativeImageSourceWin* NativeImageSourceWin::New(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) { NativeImageSourceWin* image = new NativeImageSourceWin(width, height, depth, nativeImageSource); DALI_ASSERT_DEBUG(image && "NativeImageSource allocation failed."); @@ -50,7 +50,7 @@ NativeImageSourceWin* NativeImageSourceWin::New(unsigned int width, unsigned int return image; } -NativeImageSourceWin::NativeImageSourceWin(unsigned int width, unsigned int height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) +NativeImageSourceWin::NativeImageSourceWin(uint32_t width, uint32_t height, Dali::NativeImageSource::ColorDepth depth, Any nativeImageSource) : mWidth(width), mHeight(height), mOwnPixmap(true), @@ -104,9 +104,9 @@ Any NativeImageSourceWin::GetNativeImageSource() const return Any(mPixmap); } -bool NativeImageSourceWin::GetPixels(std::vector& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const +bool NativeImageSourceWin::GetPixels(std::vector& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const { - DALI_ASSERT_DEBUG(sizeof(unsigned) == 4); + DALI_ASSERT_DEBUG(sizeof(uint32_t) == 4); bool success = false; width = mWidth; height = mHeight; @@ -165,7 +165,7 @@ void NativeImageSourceWin::DestroyResource() } } -unsigned int NativeImageSourceWin::TargetTexture() +uint32_t NativeImageSourceWin::TargetTexture() { mEglImageExtensions->TargetTextureKHR(mEglImageKHR); diff --git a/dali/internal/imaging/windows/native-image-source-impl-win.h b/dali/internal/imaging/windows/native-image-source-impl-win.h index d590782..88059d6 100644 --- a/dali/internal/imaging/windows/native-image-source-impl-win.h +++ b/dali/internal/imaging/windows/native-image-source-impl-win.h @@ -22,6 +22,7 @@ #include #include +#include namespace Dali { @@ -47,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); /** @@ -59,7 +60,7 @@ public: /** * @copydoc Dali::NativeImageSource::GetPixels() */ - bool GetPixels(std::vector& pixbuf, unsigned int& width, unsigned int& height, Pixel::Format& pixelFormat) const override; + bool GetPixels(std::vector& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override; /** * @copydoc Dali::NativeImageSource::SetSource( Any source ) @@ -89,7 +90,7 @@ public: /** * @copydoc Dali::NativeImageSource::TargetTexture() */ - unsigned int TargetTexture() override; + uint32_t TargetTexture() override; /** * @copydoc Dali::NativeImageSource::PrepareTexture() @@ -99,7 +100,7 @@ public: /** * @copydoc Dali::NativeImageSource::GetWidth() */ - unsigned int GetWidth() const override + uint32_t GetWidth() const override { return mWidth; } @@ -107,7 +108,7 @@ public: /** * @copydoc Dali::NativeImageSource::GetHeight() */ - unsigned int GetHeight() const override + uint32_t GetHeight() const override { return mHeight; } @@ -189,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); @@ -220,8 +221,8 @@ private: void GetPixmapDetails(); private: - unsigned int mWidth; ///< image width - unsigned int mHeight; ///< image heights + 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 diff --git a/dali/public-api/adaptor-framework/native-image-source.cpp b/dali/public-api/adaptor-framework/native-image-source.cpp index 1eae664..d86a705 100644 --- a/dali/public-api/adaptor-framework/native-image-source.cpp +++ b/dali/public-api/adaptor-framework/native-image-source.cpp @@ -27,7 +27,7 @@ namespace Dali { -NativeImageSourcePtr NativeImageSource::New(unsigned int width, unsigned int height, ColorDepth depth) +NativeImageSourcePtr NativeImageSource::New(uint32_t width, uint32_t height, ColorDepth depth) { Any empty; NativeImageSourcePtr image = new NativeImageSource(width, height, depth, empty); @@ -45,7 +45,7 @@ NativeImageSourcePtr NativeImageSource::New(Any nativeImageSource) return image; } -bool NativeImageSource::GetPixels(std::vector& pixbuf, unsigned int& width, unsigned int& height, Pixel::Format& pixelFormat) const +bool NativeImageSource::GetPixels(std::vector& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const { return mImpl->GetPixels(pixbuf, width, height, pixelFormat); } @@ -75,7 +75,7 @@ void NativeImageSource::DestroyResource() mImpl->DestroyResource(); } -unsigned int NativeImageSource::TargetTexture() +uint32_t NativeImageSource::TargetTexture() { return mImpl->TargetTexture(); } @@ -85,12 +85,12 @@ void NativeImageSource::PrepareTexture() mImpl->PrepareTexture(); } -unsigned int NativeImageSource::GetWidth() const +uint32_t NativeImageSource::GetWidth() const { return mImpl->GetWidth(); } -unsigned int NativeImageSource::GetHeight() const +uint32_t NativeImageSource::GetHeight() const { return mImpl->GetHeight(); } @@ -135,7 +135,7 @@ NativeImageInterface::Extension* NativeImageSource::GetExtension() return mImpl->GetNativeImageInterfaceExtension(); } -NativeImageSource::NativeImageSource(unsigned int width, unsigned int height, ColorDepth depth, Any nativeImageSource) +NativeImageSource::NativeImageSource(uint32_t width, uint32_t height, ColorDepth depth, Any nativeImageSource) { auto factory = Dali::Internal::Adaptor::GetNativeImageSourceFactory(); mImpl = factory->CreateNativeImageSource(width, height, depth, nativeImageSource).release(); diff --git a/dali/public-api/adaptor-framework/native-image-source.h b/dali/public-api/adaptor-framework/native-image-source.h index 2e4c752..8959242 100644 --- a/dali/public-api/adaptor-framework/native-image-source.h +++ b/dali/public-api/adaptor-framework/native-image-source.h @@ -88,7 +88,7 @@ public: * @param[in] depth color depth of the image * @return A smart-pointer to a newly allocated image */ - static NativeImageSourcePtr New(unsigned int width, unsigned int height, ColorDepth depth); + static NativeImageSourcePtr New(uint32_t width, uint32_t height, ColorDepth depth); /** * @brief Creates a new NativeImageSource from an existing native image source. @@ -120,7 +120,7 @@ public: * @param[out] pixelFormat pixel format used by image * @return @c true if the pixels were gotten, and @c false otherwise */ - bool GetPixels(std::vector& pixbuf, unsigned int& width, unsigned int& height, Pixel::Format& pixelFormat) const; + bool GetPixels(std::vector& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const; /** * @brief Converts the current pixel contents to either a JPEG or PNG format @@ -151,6 +151,17 @@ public: */ bool IsColorDepthSupported(ColorDepth colorDepth); +public: // native image + /** + * @copydoc Dali::NativeImageInterface::GetWidth() + */ + uint32_t GetWidth() const override; + + /** + * @copydoc Dali::NativeImageInterface::GetHeight() + */ + uint32_t GetHeight() const override; + /** * @copydoc Dali::NativeImageInterface::GetTextureTarget() */ @@ -180,7 +191,7 @@ private: // native image /** * @copydoc Dali::NativeImageInterface::TargetTexture() */ - unsigned int TargetTexture() override; + uint32_t TargetTexture() override; /** * @copydoc Dali::NativeImageInterface::PrepareTexture() @@ -188,16 +199,6 @@ private: // native image void PrepareTexture() override; /** - * @copydoc Dali::NativeImageInterface::GetWidth() - */ - unsigned int GetWidth() const override; - - /** - * @copydoc Dali::NativeImageInterface::GetHeight() - */ - unsigned int GetHeight() const override; - - /** * @copydoc Dali::NativeImageInterface::RequiresBlending() */ bool RequiresBlending() const override; @@ -232,7 +233,7 @@ private: * @param[in] depth color depth of the image * @param[in] nativeImageSource contains either: native image source or is empty */ - DALI_INTERNAL NativeImageSource(unsigned int width, unsigned int height, ColorDepth depth, Any nativeImageSource); + DALI_INTERNAL NativeImageSource(uint32_t width, uint32_t height, ColorDepth depth, Any nativeImageSource); /** * @brief A reference counted object may only be deleted by calling Unreference(). -- 2.7.4