DALI_TEST_GREATER(1024u, glyphBufferData2000.width, TEST_LOCATION); //924u
DALI_TEST_GREATER(glyphBufferData2000.height, 1024u, TEST_LOCATION); //1148u
+ // Test GlyphBufferData move
+ TextAbstraction::FontClient::GlyphBufferData movedGlyphBufferData2000 = std::move(glyphBufferData2000);
+
+ for(int i = 0; i < 50; ++i)
+ {
+ TextAbstraction::FontClient::GlyphBufferData dummy = std::move(movedGlyphBufferData2000);
+ movedGlyphBufferData2000 = std::move(dummy);
+
+ // Test moved GlyphBufferData destruct well
+ }
+
+ DALI_TEST_GREATER(1024u, movedGlyphBufferData2000.width, TEST_LOCATION); //924u
+ DALI_TEST_GREATER(movedGlyphBufferData2000.height, 1024u, TEST_LOCATION); //1148u
+
END_TEST;
}
END_TEST;
}
+int UtcDaliEncodedImageBufferMoveConstructor(void)
+{
+ EncodedImageBuffer buffer = EncodedImageBuffer::New(tinybuffer());
+ EncodedImageBuffer bufferMoved = std::move(buffer);
+
+ DALI_TEST_EQUALS((bool)buffer, false, TEST_LOCATION);
+ DALI_TEST_EQUALS((bool)bufferMoved, true, TEST_LOCATION);
+ END_TEST;
+}
+
+int UtcDaliEncodedImageBufferMoveAssignmentOperator(void)
+{
+ EncodedImageBuffer buffer = EncodedImageBuffer::New(tinybuffer());
+
+ EncodedImageBuffer buffer2;
+ DALI_TEST_EQUALS((bool)buffer, true, TEST_LOCATION);
+ DALI_TEST_EQUALS((bool)buffer2, false, TEST_LOCATION);
+
+ buffer2 = std::move(buffer);
+ DALI_TEST_EQUALS((bool)buffer, false, TEST_LOCATION);
+ DALI_TEST_EQUALS((bool)buffer2, true, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliEncodedImageBufferGetRawBuffer(void)
{
EncodedImageBuffer::RawBufferType originBuffer = tinybuffer();
test_return_value = TET_PASS;
}
+int UtcDaliAnimatedImageLoadingCopyMoveP(void)
+{
+ Dali::AnimatedImageLoading animatedImageLoading = Dali::AnimatedImageLoading::New(gGif_100_None, true);
+
+ Dali::AnimatedImageLoading copied = animatedImageLoading;
+
+ DALI_TEST_EQUALS((bool)animatedImageLoading, true, TEST_LOCATION);
+ DALI_TEST_EQUALS((bool)copied, true, TEST_LOCATION);
+
+ Dali::AnimatedImageLoading moved = std::move(animatedImageLoading);
+
+ DALI_TEST_EQUALS((bool)animatedImageLoading, false, TEST_LOCATION);
+ DALI_TEST_EQUALS((bool)copied, true, TEST_LOCATION);
+ DALI_TEST_EQUALS((bool)moved, true, TEST_LOCATION);
+
+ Dali::AnimatedImageLoading copiedAssign;
+ copiedAssign = copied;
+
+ Dali::AnimatedImageLoading movedAssign;
+ movedAssign = std::move(moved);
+
+ DALI_TEST_EQUALS((bool)animatedImageLoading, false, TEST_LOCATION);
+ DALI_TEST_EQUALS((bool)copied, true, TEST_LOCATION);
+ DALI_TEST_EQUALS((bool)moved, false, TEST_LOCATION);
+ DALI_TEST_EQUALS((bool)copiedAssign, true, TEST_LOCATION);
+ DALI_TEST_EQUALS((bool)movedAssign, true, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliAnimatedImageLoadingGetImageSizeP(void)
{
Dali::AnimatedImageLoading animatedImageLoading = Dali::AnimatedImageLoading::New(gGif_100_None, true);
END_TEST;
}
+int UtcDaliPixelBufferConstructor01P(void)
+{
+ TestApplication application;
+ Devel::PixelBuffer pixbuf = Devel::PixelBuffer::New(10, 10, Pixel::RGBA8888);
+
+ Devel::PixelBuffer copiedBuf = pixbuf;
+ DALI_TEST_CHECK(pixbuf);
+ DALI_TEST_CHECK(copiedBuf);
+ DALI_TEST_CHECK(pixbuf.GetBuffer() != NULL);
+ DALI_TEST_CHECK(copiedBuf.GetBuffer() != NULL);
+
+ Devel::PixelBuffer movedBuf = std::move(pixbuf);
+ DALI_TEST_CHECK(!pixbuf);
+ DALI_TEST_CHECK(movedBuf);
+ DALI_TEST_CHECK(movedBuf.GetBuffer() != NULL);
+ END_TEST;
+}
+
+int UtcDaliPixelBufferAssign01P(void)
+{
+ TestApplication application;
+ Devel::PixelBuffer pixbuf = Devel::PixelBuffer::New(10, 10, Pixel::RGBA8888);
+
+ Devel::PixelBuffer copiedBuf;
+ copiedBuf = pixbuf;
+ DALI_TEST_CHECK(pixbuf);
+ DALI_TEST_CHECK(copiedBuf);
+ DALI_TEST_CHECK(pixbuf.GetBuffer() != NULL);
+ DALI_TEST_CHECK(copiedBuf.GetBuffer() != NULL);
+
+ Devel::PixelBuffer movedBuf;
+ DALI_TEST_CHECK(!movedBuf);
+ movedBuf = std::move(pixbuf);
+ DALI_TEST_CHECK(!pixbuf);
+ DALI_TEST_CHECK(movedBuf);
+ DALI_TEST_CHECK(movedBuf.GetBuffer() != NULL);
+ END_TEST;
+}
+
int UtcDaliPixelBufferNew01N(void)
{
TestApplication application;
#define DALI_ANIMATED_IMAGE_LOADING_H
/*
- * Copyright (c) 2021 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.
AnimatedImageLoading& operator=(const AnimatedImageLoading& rhs) = default;
/**
+ * @brief Move constructor.
+ *
+ * @param[in] move The AnimatedImageLoading to move
+ */
+ AnimatedImageLoading(AnimatedImageLoading&& move) = default;
+
+ /**
+ * @brief Move assignment operator
+ *
+ * @param[in] rhs The AnimatedImageLoading to move
+ * @return A reference to this
+ */
+ AnimatedImageLoading& operator=(AnimatedImageLoading&& rhs) = default;
+
+ /**
* @brief Destructor
*/
~AnimatedImageLoading();
/*
- * Copyright (c) 2020 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.
{
}
-ColorController::ColorController(const ColorController& controller)
-: BaseHandle(controller)
-{
-}
+ColorController::ColorController(const ColorController& controller) = default;
-ColorController& ColorController::operator=(const ColorController& rhs)
-{
- BaseHandle::operator=(rhs);
- return *this;
-}
+ColorController& ColorController::operator=(const ColorController& rhs) = default;
+
+ColorController::ColorController(ColorController&& controller) = default;
+
+ColorController& ColorController::operator=(ColorController&& rhs) = default;
ColorController ColorController::Get()
{
#define DALI_COLOR_CONTROLLER_H
/*
- * Copyright (c) 2020 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.
ColorController& operator=(const ColorController& rhs);
/**
+ * @brief Creates a move of the handle.
+ *
+ * The move will point to the same implementation as the original.
+ * @param[in] colorController The Color Controller to move from.
+ */
+ ColorController(ColorController&& colorController);
+
+ /**
+ * @brief This move assignment operator is required for (smart) pointer semantics.
+ *
+ * @param [in] rhs A reference to the moved handle
+ * @return A reference to this
+ */
+ ColorController& operator=(ColorController&& rhs);
+
+ /**
* @brief Retrieve the initialized instance of the ColorController.
*
* @return Handle to ColorController.
/*
- * Copyright (c) 2021 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.
OffscreenWindow& OffscreenWindow::operator=(const OffscreenWindow& window) = default;
+OffscreenWindow::OffscreenWindow(OffscreenWindow&& window) = default;
+
+OffscreenWindow& OffscreenWindow::operator=(OffscreenWindow&& window) = default;
+
OffscreenWindow::~OffscreenWindow() = default;
void OffscreenWindow::Add(Actor actor)
#define DALI_OFFSCREEN_WINDOW_H
/*
- * Copyright (c) 2021 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.
OffscreenWindow& operator=(const OffscreenWindow& window);
/**
+ * @brief Move constructor
+ *
+ * @param [in] window A reference to the moved handle
+ */
+ OffscreenWindow(OffscreenWindow&& window);
+
+ /**
+ * @brief Move assignment operator
+ *
+ * @param [in] window A reference to the moved handle
+ * @return A reference to this
+ */
+ OffscreenWindow& operator=(OffscreenWindow&& window);
+
+ /**
* @brief Destructor
*/
~OffscreenWindow();
{
namespace Devel
{
-PixelBuffer PixelBuffer::New(unsigned int width,
- unsigned int height,
+PixelBuffer PixelBuffer::New(uint32_t width,
+ uint32_t height,
Dali::Pixel::Format pixelFormat)
{
Internal::Adaptor::PixelBufferPtr internal =
{
}
-PixelBuffer::PixelBuffer(const PixelBuffer& handle)
-: BaseHandle(handle)
-{
-}
+PixelBuffer::PixelBuffer(const PixelBuffer& handle) = default;
-PixelBuffer& PixelBuffer::operator=(const PixelBuffer& rhs)
-{
- BaseHandle::operator=(rhs);
- return *this;
-}
+PixelBuffer& PixelBuffer::operator=(const PixelBuffer& rhs) = default;
+
+PixelBuffer::PixelBuffer(PixelBuffer&& handle) = default;
+
+PixelBuffer& PixelBuffer::operator=(PixelBuffer&& rhs) = default;
-unsigned int PixelBuffer::GetWidth() const
+uint32_t PixelBuffer::GetWidth() const
{
return GetImplementation(*this).GetWidth();
}
-unsigned int PixelBuffer::GetHeight() const
+uint32_t PixelBuffer::GetHeight() const
{
return GetImplementation(*this).GetHeight();
}
-unsigned int PixelBuffer::GetStride() const
+uint32_t PixelBuffer::GetStride() const
{
return GetImplementation(*this).GetStride();
}
return GetImplementation(*this).GetPixelFormat();
}
-unsigned char* PixelBuffer::GetBuffer()
+uint8_t* PixelBuffer::GetBuffer()
{
return GetImplementation(*this).GetBuffer();
}
-const unsigned char* const PixelBuffer::GetBuffer() const
+const uint8_t* PixelBuffer::GetBuffer() const
{
return GetImplementation(*this).GetConstBuffer();
}
/**
* Create a PixelBuffer with it's own data buffer.
*/
- static PixelBuffer New(unsigned int width,
- unsigned int height,
+ static PixelBuffer New(uint32_t width,
+ uint32_t height,
Dali::Pixel::Format pixelFormat);
/**
PixelBuffer& operator=(const PixelBuffer& rhs);
/**
+ * @brief This move constructor is required for (smart) pointer semantics.
+ *
+ * @SINCE_2_1.45
+ * @param[in] handle A reference to the moved handle
+ */
+ PixelBuffer(PixelBuffer&& handle);
+
+ /**
+ * @brief This move assignment operator is required for (smart) pointer semantics.
+ *
+ * @SINCE_2_1.45
+ * @param[in] rhs A reference to the moved handle
+ * @return A reference to this object
+ */
+ PixelBuffer& operator=(PixelBuffer&& rhs);
+
+ /**
* Convert to a pixel data and release the pixelBuffer's object.
* This handle is left empty.
*
* @SINCE_1_2.46
* @return The pixel buffer, or NULL.
*/
- unsigned char* GetBuffer();
+ uint8_t* GetBuffer();
/**
* @brief Gets the pixel buffer. This is a pointer to the internal
*
* @return The pixel buffer, or NULL.
*/
- const unsigned char* const GetBuffer() const;
+ const uint8_t* GetBuffer() const;
/**
* @brief Gets the width of the buffer in pixels.
* @SINCE_1_2.46
* @return The width of the buffer in pixels
*/
- unsigned int GetWidth() const;
+ uint32_t GetWidth() const;
/**
* @brief Gets the height of the buffer in pixels.
* @SINCE_1_2.46
* @return The height of the buffer in pixels
*/
- unsigned int GetHeight() const;
+ uint32_t GetHeight() const;
/**
* @brief Gets the stride of the buffer in pixels.
* @SINCE_2_1.17
* @return The stride of the buffer in pixels. 0 means the buffer is tightly packed.
*/
- unsigned int GetStride() const;
+ uint32_t GetStride() const;
/**
* @brief Gets the pixel format.
/*
- * Copyright (c) 2020 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.
{
}
-StyleMonitor::StyleMonitor(const StyleMonitor& monitor)
-: BaseHandle(monitor)
-{
-}
+StyleMonitor::StyleMonitor(const StyleMonitor& monitor) = default;
+
+StyleMonitor& StyleMonitor::operator=(const StyleMonitor& monitor) = default;
+
+StyleMonitor::StyleMonitor(StyleMonitor&& monitor) = default;
+
+StyleMonitor& StyleMonitor::operator=(StyleMonitor&& monitor) = default;
StyleMonitor StyleMonitor::StyleMonitor::Get()
{
return GetImplementation(*this).StyleChangeSignal();
}
-StyleMonitor& StyleMonitor::operator=(const StyleMonitor& monitor)
-{
- if(*this != monitor)
- {
- BaseHandle::operator=(monitor);
- }
- return *this;
-}
-
StyleMonitor::StyleMonitor(Internal::Adaptor::StyleMonitor* internal)
: BaseHandle(internal)
{
#define DALI_STYLE_MONITOR_H
/*
- * Copyright (c) 2020 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.
StyleMonitor(const StyleMonitor& monitor);
/**
+ * @brief Assignment operator.
+ *
+ * The handle points to the same implementation as the one being copied from.
+ * @param[in] monitor The Style Monitor to copy from.
+ * @return reference to this object
+ */
+ StyleMonitor& operator=(const StyleMonitor& monitor);
+
+ /**
+ * @brief Creates a move of the handle.
+ *
+ * The move will point to the same implementation as the original.
+ * @param[in] monitor The Style Monitor to move from.
+ */
+ StyleMonitor(StyleMonitor&& monitor);
+
+ /**
+ * @brief Move assignment operator.
+ *
+ * The handle points to the same implementation as the one being moved from.
+ * @param[in] monitor The Style Monitor to move from.
+ * @return reference to this object
+ */
+ StyleMonitor& operator=(StyleMonitor&& monitor);
+
+ /**
* @brief Retrieve the initialized instance of the StyleMonitor.
* @return Handle to StyleMonitor.
*/
*/
StyleChangeSignalType& StyleChangeSignal();
-public: // Operators
- /**
- * @brief Assignment operator.
- *
- * The handle points to the same implementation as the one being copied from.
- * @param[in] monitor The Style Monitor to copy from.
- * @return reference to this object
- */
- StyleMonitor& operator=(const StyleMonitor& monitor);
-
public: // Not intended for application developers
/**
* @brief This constructor is used internally to create a handle from an object pointer.
/*
- * Copyright (c) 2020 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.
return VideoPlayer(player.Get());
}
-VideoPlayer::VideoPlayer(const VideoPlayer& player)
-: BaseHandle(player)
-{
-}
+VideoPlayer::VideoPlayer(const VideoPlayer& player) = default;
-VideoPlayer& VideoPlayer::operator=(const VideoPlayer& player)
-{
- if(*this != player)
- {
- BaseHandle::operator=(player);
- }
- return *this;
-}
+VideoPlayer& VideoPlayer::operator=(const VideoPlayer& player) = default;
+
+VideoPlayer::VideoPlayer(VideoPlayer&& player) = default;
+
+VideoPlayer& VideoPlayer::operator=(VideoPlayer&& player) = default;
VideoPlayer VideoPlayer::DownCast(BaseHandle handle)
{
#define DALI_VIDEO_PLAYER_H
/*
- * Copyright (c) 2020 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.
VideoPlayer& operator=(const VideoPlayer& player);
/**
+ * @brief Move constructor.
+ *
+ * @SINCE_2_1.45
+ * @param[in] player VideoPlayer to move. The moved player will point at the same implementation
+ */
+ VideoPlayer(VideoPlayer&& player);
+
+ /**
+ * @brief Move assignment operator.
+ *
+ * @SINCE_2_1.45
+ * @param[in] player The VideoPlayer to move assign from.
+ * @return The updated VideoPlayer.
+ */
+ VideoPlayer& operator=(VideoPlayer&& player);
+
+ /**
* @brief Downcast a handle to VideoPlayer handle.
*
* If handle points to a VideoPlayer the downcast produces valid
return Internal::Adaptor::WebEngine::GetCookieManager();
}
-WebEngine::WebEngine(const WebEngine& webEngine)
-: BaseHandle(webEngine)
-{
-}
+WebEngine::WebEngine(const WebEngine& webEngine) = default;
-WebEngine& WebEngine::operator=(const WebEngine& webEngine)
-{
- if(*this != webEngine)
- {
- BaseHandle::operator=(webEngine);
- }
- return *this;
-}
+WebEngine& WebEngine::operator=(const WebEngine& webEngine) = default;
+
+WebEngine::WebEngine(WebEngine&& webEngine) = default;
+
+WebEngine& WebEngine::operator=(WebEngine&& webEngine) = default;
WebEngine WebEngine::DownCast(BaseHandle handle)
{
WebEngine& operator=(const WebEngine& WebEngine);
/**
+ * @brief Move constructor.
+ *
+ * @param[in] WebEngine WebEngine to move. The moved WebEngine will point at the same implementation
+ */
+ WebEngine(WebEngine&& WebEngine);
+
+ /**
+ * @brief Move assignment operator.
+ *
+ * @param[in] WebEngine The WebEngine to assign from.
+ * @return The updated WebEngine.
+ */
+ WebEngine& operator=(WebEngine&& WebEngine);
+
+ /**
* @brief Downcast a handle to WebEngine handle.
*
* If handle points to a WebEngine the downcast produces valid
outlineOffsetX{0},
outlineOffsetY{0},
format{Pixel::A8},
- compressionType(CompressionType::NO_COMPRESSION),
+ compressionType{CompressionType::NO_COMPRESSION},
isColorEmoji{false},
isColorBitmap{false},
isBufferOwned{false}
}
}
+FontClient::GlyphBufferData::GlyphBufferData(FontClient::GlyphBufferData&& rhs) noexcept
+: buffer{rhs.buffer},
+ width{rhs.width},
+ height{rhs.height},
+ outlineOffsetX{rhs.outlineOffsetX},
+ outlineOffsetY{rhs.outlineOffsetY},
+ format{rhs.format},
+ compressionType{rhs.compressionType},
+ isColorEmoji{rhs.isColorEmoji},
+ isColorBitmap{rhs.isColorBitmap},
+ isBufferOwned{rhs.isBufferOwned}
+{
+ // Remove moved data
+ rhs.buffer = nullptr;
+ rhs.isBufferOwned = false;
+}
+
+FontClient::GlyphBufferData& FontClient::GlyphBufferData::operator=(FontClient::GlyphBufferData&& rhs) noexcept
+{
+ buffer = rhs.buffer;
+ width = rhs.width;
+ height = rhs.height;
+ outlineOffsetX = rhs.outlineOffsetX;
+ outlineOffsetY = rhs.outlineOffsetY;
+ format = rhs.format;
+ compressionType = rhs.compressionType;
+ isColorEmoji = rhs.isColorEmoji;
+ isColorBitmap = rhs.isColorBitmap;
+ isBufferOwned = rhs.isBufferOwned;
+
+ // Remove moved data
+ rhs.buffer = nullptr;
+ rhs.isBufferOwned = false;
+
+ return *this;
+}
+
size_t FontClient::GlyphBufferData::Compress(const uint8_t* const __restrict__ inBuffer, GlyphBufferData& __restrict__ outBufferData)
{
size_t bufferSize = 0u;
{
}
-FontClient::FontClient(const FontClient& handle)
-: BaseHandle(handle)
-{
-}
+FontClient::FontClient(const FontClient& handle) = default;
-FontClient& FontClient::operator=(const FontClient& handle)
-{
- BaseHandle::operator=(handle);
- return *this;
-}
+FontClient& FontClient::operator=(const FontClient& handle) = default;
+
+FontClient::FontClient(FontClient&& handle) = default;
+
+FontClient& FontClient::operator=(FontClient&& handle) = default;
void FontClient::ClearCache()
{
*/
~GlyphBufferData();
+ /**
+ * @brief Move constructor.
+ *
+ * @param[in] rhs moved data.
+ */
+ GlyphBufferData(GlyphBufferData&& rhs) noexcept;
+
+ /**
+ * @brief Move assign operator.
+ *
+ * @param[in] rhs moved data.
+ * @return A reference to this.
+ */
+ GlyphBufferData& operator=(GlyphBufferData&& rhs) noexcept;
+
// Compression method of buffer. Each buffer compressed line by line
enum class CompressionType
{
*/
static void DecompressScanline(const GlyphBufferData& inBufferData, uint8_t* outBuffer, uint32_t& offset);
+ private:
+ // Delete copy operation.
+ GlyphBufferData(const GlyphBufferData& rhs) = delete;
+ GlyphBufferData& operator=(const GlyphBufferData& rhs) = delete;
+
+ public:
uint8_t* buffer; ///< The glyph's bitmap buffer data.
uint32_t width; ///< The width of the bitmap.
uint32_t height; ///< The height of the bitmap.
*/
FontClient& operator=(const FontClient& handle);
+ /**
+ * @brief This move constructor is required for (smart) pointer semantics.
+ *
+ * @param[in] handle A reference to the moved handle.
+ */
+ FontClient(FontClient&& handle);
+
+ /**
+ * @brief This move assignment operator is required for (smart) pointer semantics.
+ *
+ * @param [in] handle A reference to the moved handle.
+ * @return A reference to this.
+ */
+ FontClient& operator=(FontClient&& handle);
+
////////////////////////////////////////
// Font management and validation.
////////////////////////////////////////
/*
- * Copyright (c) 2021 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.
#include <dali/internal/accessibility/bridge/bridge-accessible.h>
// EXTERNAL INCLUDES
+#include <dali/public-api/math/math-utils.h>
+
#include <algorithm>
#include <iostream>
// Find first with non-zero area
auto first = std::find_if(children.begin(), children.end(), [](Component* child) -> bool {
auto extents = child->GetExtents(CoordinateType::WINDOW);
- return extents.height != 0.0f && extents.width != 0.0f;
+ return !Dali::EqualsZero(extents.height) && !Dali::EqualsZero(extents.width);
});
if(first == children.end())
auto child = *it;
rect = child->GetExtents(CoordinateType::WINDOW);
- if(rect.height == 0.0f || rect.width == 0.0f)
+ if(Dali::EqualsZero(rect.height) || Dali::EqualsZero(rect.width))
{
// Zero area, ignore
continue;
return false;
}
auto extents = obj->GetExtents(CoordinateType::WINDOW);
- return extents.height == 0 || extents.width == 0;
+ return Dali::EqualsZero(extents.height) || Dali::EqualsZero(extents.width);
}
static bool IsObjectAcceptable(Component* obj)
return std::string(GET_NAVIGABLE_AT_POINT_MAX_RECURSION_DEPTH - maxRecursionDepth, ' ');
}
-
static bool IsRoleAcceptableWhenNavigatingNextPrev(Accessible* obj)
{
if(!obj)
#include <dali/integration-api/gl-abstraction.h>
#include <dali/integration-api/gl-defines.h>
#include <dali/internal/graphics/common/graphics-interface.h>
+#include <dali/public-api/math/math-utils.h>
#include "egl-graphics-controller.h"
#include "gles-graphics-buffer.h"
const auto clearValues = renderPassBegin.clearValues.Ptr();
- if(!mImpl->mGlStateCache.mClearColorSet ||
- mImpl->mGlStateCache.mClearColor.r != clearValues[0].color.r ||
- mImpl->mGlStateCache.mClearColor.g != clearValues[0].color.g ||
- mImpl->mGlStateCache.mClearColor.b != clearValues[0].color.b ||
- mImpl->mGlStateCache.mClearColor.a != clearValues[0].color.a)
+ if(!Dali::Equals(mImpl->mGlStateCache.mClearColor.r, clearValues[0].color.r) ||
+ !Dali::Equals(mImpl->mGlStateCache.mClearColor.g, clearValues[0].color.g) ||
+ !Dali::Equals(mImpl->mGlStateCache.mClearColor.b, clearValues[0].color.b) ||
+ !Dali::Equals(mImpl->mGlStateCache.mClearColor.a, clearValues[0].color.a) ||
+ !mImpl->mGlStateCache.mClearColorSet)
{
gl.ClearColor(clearValues[0].color.r,
clearValues[0].color.g,
}
}
-void LanczosSample4BPP(const unsigned char* __restrict__ inPixels,
+void LanczosSample4BPP(const uint8_t* __restrict__ inPixels,
ImageDimensions inputDimensions,
- unsigned int inputStride,
- unsigned char* __restrict__ outPixels,
+ uint32_t inputStride,
+ uint8_t* __restrict__ outPixels,
ImageDimensions desiredDimensions)
{
Resample(inPixels, inputDimensions, inputStride, outPixels, desiredDimensions, Resampler::LANCZOS4, 4, true);
}
-void LanczosSample1BPP(const unsigned char* __restrict__ inPixels,
+void LanczosSample1BPP(const uint8_t* __restrict__ inPixels,
ImageDimensions inputDimensions,
- unsigned int inputStride,
- unsigned char* __restrict__ outPixels,
+ uint32_t inputStride,
+ uint8_t* __restrict__ outPixels,
ImageDimensions desiredDimensions)
{
// For L8 images
}
// Dispatch to a format-appropriate third-party resampling function:
-void LanczosSample(const unsigned char* __restrict__ inPixels,
+void LanczosSample(const uint8_t* __restrict__ inPixels,
ImageDimensions inDimensions,
- unsigned int inStride,
+ uint32_t inStride,
Pixel::Format pixelFormat,
- unsigned char* __restrict__ outPixels,
+ uint8_t* __restrict__ outPixels,
ImageDimensions outDimensions)
{
// Check the pixel format is one that is supported:
}
else
{
- DALI_LOG_INFO(gImageOpsLogFilter, Dali::Integration::Log::Verbose, "Bitmap was not lanczos sampled: unsupported pixel format: %u.\n", unsigned(pixelFormat));
+ DALI_LOG_INFO(gImageOpsLogFilter, Dali::Integration::Log::Verbose, "Bitmap was not lanczos sampled: unsupported pixel format: %u.\n", static_cast<uint32_t>(pixelFormat));
}
}
void RotateByShear(const uint8_t* const pixelsIn,
- unsigned int widthIn,
- unsigned int heightIn,
- unsigned int strideIn,
- unsigned int pixelSize,
+ uint32_t widthIn,
+ uint32_t heightIn,
+ uint32_t strideIn,
+ uint32_t pixelSize,
float radians,
uint8_t*& pixelsOut,
- unsigned int& widthOut,
- unsigned int& heightOut)
+ uint32_t& widthOut,
+ uint32_t& heightOut)
{
// @note Code got from https://www.codeproject.com/Articles/202/High-quality-image-rotation-rotate-by-shear by Eran Yariv.
// Do first the fast rotations to transform the angle into a (-45..45] range.
- float fastRotationPerformed = false;
+ bool fastRotationPerformed = false;
if((radians > Math::PI_4) && (radians <= RAD_135))
{
// Angle in (45.0 .. 135.0]
const uint8_t* const firstHorizontalSkewPixelsIn = fastRotationPerformed ? pixelsOut : pixelsIn;
std::unique_ptr<uint8_t, void (*)(void*)> tmpPixelsInPtr((fastRotationPerformed ? pixelsOut : nullptr), free);
- unsigned int stride = fastRotationPerformed ? widthOut : strideIn;
+ uint32_t stride = fastRotationPerformed ? widthOut : strideIn;
// Reset the input/output
widthIn = widthOut;
// Calculate first shear (horizontal) destination image dimensions
- widthOut = widthIn + static_cast<unsigned int>(fabs(angleTangent) * static_cast<float>(heightIn));
+ widthOut = widthIn + static_cast<uint32_t>(fabs(angleTangent) * static_cast<float>(heightIn));
heightOut = heightIn;
// Allocate the buffer for the 1st shear
return;
}
- for(unsigned int y = 0u; y < heightOut; ++y)
+ for(uint32_t y = 0u; y < heightOut; ++y)
{
const float shear = angleTangent * ((angleTangent >= 0.f) ? (0.5f + static_cast<float>(y)) : (0.5f + static_cast<float>(y) - static_cast<float>(heightOut)));
// Reset the 'pixel in' pointer with the output of the 'First Horizontal Skew' and free the memory allocated by the 'Fast Rotations'.
tmpPixelsInPtr.reset(pixelsOut);
- unsigned int tmpWidthIn = widthOut;
- unsigned int tmpHeightIn = heightOut;
+ uint32_t tmpWidthIn = widthOut;
+ uint32_t tmpHeightIn = heightOut;
// Reset the input/output
pixelsOut = nullptr;
///////////////////////////////////////
// Calc 2nd shear (vertical) destination image dimensions
- heightOut = static_cast<unsigned int>(static_cast<float>(widthIn) * fabs(angleSinus) + static_cast<float>(heightIn) * angleCosinus);
+ heightOut = static_cast<uint32_t>(static_cast<float>(widthIn) * fabs(angleSinus) + static_cast<float>(heightIn) * angleCosinus);
// Allocate the buffer for the 2nd shear
pixelsOut = static_cast<uint8_t*>(malloc(widthOut * heightOut * pixelSize));
// Variable skew offset
float offset = angleSinus * ((angleSinus > 0.f) ? static_cast<float>(widthIn - 1u) : -(static_cast<float>(widthIn) - static_cast<float>(widthOut)));
- unsigned int column = 0u;
+ uint32_t column = 0u;
for(column = 0u; column < widthOut; ++column, offset -= angleSinus)
{
- const int shear = static_cast<int>(floor(offset));
+ const int32_t shear = static_cast<int32_t>(floor(offset));
VerticalSkew(tmpPixelsInPtr.get(), tmpWidthIn, tmpHeightIn, tmpWidthIn, pixelSize, pixelsOut, widthOut, heightOut, column, shear, offset - static_cast<float>(shear));
}
// Reset the 'pixel in' pointer with the output of the 'Vertical Skew' and free the memory allocated by the 'First Horizontal Skew'.
///////////////////////////////////////
// Calc 3rd shear (horizontal) destination image dimensions
- widthOut = static_cast<unsigned int>(static_cast<float>(heightIn) * fabs(angleSinus) + static_cast<float>(widthIn) * angleCosinus) + 1u;
+ widthOut = static_cast<uint32_t>(static_cast<float>(heightIn) * fabs(angleSinus) + static_cast<float>(widthIn) * angleCosinus) + 1u;
// Allocate the buffer for the 3rd shear
pixelsOut = static_cast<uint8_t*>(malloc(widthOut * heightOut * pixelSize));
offset = (angleSinus >= 0.f) ? -angleSinus * angleTangent * static_cast<float>(widthIn - 1u) : angleTangent * (static_cast<float>(widthIn - 1u) * -angleSinus + (1.f - static_cast<float>(heightOut)));
- for(unsigned int y = 0u; y < heightOut; ++y, offset += angleTangent)
+ for(uint32_t y = 0u; y < heightOut; ++y, offset += angleTangent)
{
- const int shear = static_cast<int>(floor(offset));
+ const int32_t shear = static_cast<int32_t>(floor(offset));
HorizontalSkew(tmpPixelsInPtr.get(), tmpWidthIn, tmpWidthIn, pixelSize, pixelsOut, widthOut, y, shear, offset - static_cast<float>(shear));
}
}
void HorizontalShear(const uint8_t* const pixelsIn,
- unsigned int widthIn,
- unsigned int heightIn,
- unsigned int strideIn,
- unsigned int pixelSize,
+ uint32_t widthIn,
+ uint32_t heightIn,
+ uint32_t strideIn,
+ uint32_t pixelSize,
float radians,
uint8_t*& pixelsOut,
- unsigned int& widthOut,
- unsigned int& heightOut)
+ uint32_t& widthOut,
+ uint32_t& heightOut)
{
// Calculate the destination image dimensions.
return;
}
- widthOut = widthIn + static_cast<unsigned int>(ceil(absRadians * static_cast<float>(heightIn)));
+ widthOut = widthIn + static_cast<uint32_t>(ceil(absRadians * static_cast<float>(heightIn)));
heightOut = heightIn;
// Allocate the buffer for the shear.
return;
}
- for(unsigned int y = 0u; y < heightOut; ++y)
+ for(uint32_t y = 0u; y < heightOut; ++y)
{
const float shear = radians * ((radians >= 0.f) ? (0.5f + static_cast<float>(y)) : (0.5f + static_cast<float>(y) - static_cast<float>(heightOut)));
- const int intShear = static_cast<int>(floor(shear));
+ const int32_t intShear = static_cast<int32_t>(floor(shear));
HorizontalSkew(pixelsIn, widthIn, strideIn, pixelSize, pixelsOut, widthOut, y, intShear, shear - static_cast<float>(intShear));
}
}
constexpr uint32_t BRIGHTNESS_CONSTANT_B = 114;
} // namespace
-PixelBuffer::PixelBuffer(unsigned char* buffer,
- unsigned int bufferSize,
- unsigned int width,
- unsigned int height,
- unsigned int stride,
+PixelBuffer::PixelBuffer(uint8_t* buffer,
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
+ uint32_t stride,
Dali::Pixel::Format pixelFormat)
: mMetadata(),
mBuffer(buffer),
ReleaseBuffer();
}
-PixelBufferPtr PixelBuffer::New(unsigned int width,
- unsigned int height,
+PixelBufferPtr PixelBuffer::New(uint32_t width,
+ uint32_t height,
Dali::Pixel::Format pixelFormat)
{
- unsigned int bufferSize = width * height * Dali::Pixel::GetBytesPerPixel(pixelFormat);
- unsigned char* buffer = NULL;
+ uint32_t bufferSize = width * height * Dali::Pixel::GetBytesPerPixel(pixelFormat);
+ uint8_t* buffer = NULL;
if(bufferSize > 0)
{
- buffer = static_cast<unsigned char*>(malloc(bufferSize));
+ buffer = static_cast<uint8_t*>(malloc(bufferSize));
}
return new PixelBuffer(buffer, bufferSize, width, height, width, pixelFormat);
}
-PixelBufferPtr PixelBuffer::New(unsigned char* buffer,
- unsigned int bufferSize,
- unsigned int width,
- unsigned int height,
- unsigned int stride,
+PixelBufferPtr PixelBuffer::New(uint8_t* buffer,
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
+ uint32_t stride,
Dali::Pixel::Format pixelFormat)
{
return new PixelBuffer(buffer, bufferSize, width, height, stride, pixelFormat);
return pixelData;
}
-unsigned int PixelBuffer::GetWidth() const
+uint32_t PixelBuffer::GetWidth() const
{
return mWidth;
}
-unsigned int PixelBuffer::GetHeight() const
+uint32_t PixelBuffer::GetHeight() const
{
return mHeight;
}
return mPixelFormat;
}
-unsigned char* PixelBuffer::GetBuffer() const
+uint8_t* PixelBuffer::GetBuffer() const
{
return mBuffer;
}
-const unsigned char* const PixelBuffer::GetConstBuffer() const
+const uint8_t* PixelBuffer::GetConstBuffer() const
{
return mBuffer;
}
-unsigned int PixelBuffer::GetBufferSize() const
+uint32_t PixelBuffer::GetBufferSize() const
{
return mBufferSize;
}
Dali::PixelData PixelBuffer::CreatePixelData() const
{
- unsigned char* destBuffer = NULL;
+ uint8_t* destBuffer = NULL;
if(mBufferSize > 0)
{
- destBuffer = static_cast<unsigned char*>(malloc(mBufferSize));
+ destBuffer = static_cast<uint8_t*>(malloc(mBufferSize));
memcpy(destBuffer, mBuffer, mBufferSize);
}
destStride = (inBuffer.mWidth - x) * bytesPerPixel;
}
- int srcOffset = x * bytesPerPixel + y * srcStride;
- int destOffset = 0;
- unsigned char* destBuffer = outBuffer->mBuffer;
+ int srcOffset = x * bytesPerPixel + y * srcStride;
+ int destOffset = 0;
+ uint8_t* destBuffer = outBuffer->mBuffer;
// Clamp crop to last row
- unsigned int endRow = y + cropDimensions.GetHeight();
+ uint16_t endRow = y + cropDimensions.GetHeight();
if(endRow > inBuffer.mHeight)
{
endRow = inBuffer.mHeight - 1;
// must be skipped in such case
if(Pixel::GetBytesPerPixel(mPixelFormat) && Pixel::HasAlpha(mPixelFormat))
{
- unsigned char* pixel = mBuffer;
- const unsigned int strideBytes = mStride * bytesPerPixel;
- const unsigned int widthBytes = mWidth * bytesPerPixel;
+ uint8_t* pixel = mBuffer;
+ const uint32_t strideBytes = mStride * bytesPerPixel;
+ const uint32_t widthBytes = mWidth * bytesPerPixel;
// Collect all valid channel list before lookup whole buffer
std::vector<Channel> validChannelList;
if(DALI_LIKELY(!validChannelList.empty()))
{
- for(unsigned int y = 0; y < mHeight; y++)
+ for(uint32_t y = 0; y < mHeight; y++)
{
- for(unsigned int x = 0; x < widthBytes; x += bytesPerPixel)
+ for(uint32_t x = 0; x < widthBytes; x += bytesPerPixel)
{
- unsigned int alpha = ReadChannel(&pixel[x], mPixelFormat, Adaptor::ALPHA);
+ uint32_t alpha = ReadChannel(&pixel[x], mPixelFormat, Adaptor::ALPHA);
if(alpha < 255)
{
// If alpha is 255, we don't need to change color. Skip current pixel
if(bytesPerPixel && mWidth && mHeight)
{
- unsigned char* pixel = mBuffer;
+ uint8_t* pixel = mBuffer;
const uint32_t strideBytes = mStride * bytesPerPixel;
const uint32_t widthBytes = mWidth * bytesPerPixel;
const uint32_t bufferSize = mWidth * mHeight;
uint64_t green = 0;
uint64_t blue = 0;
- for(unsigned int y = 0; y < mHeight; y++)
+ for(uint32_t y = 0; y < mHeight; y++)
{
- for(unsigned int x = 0; x < widthBytes; x += bytesPerPixel)
+ for(uint32_t x = 0; x < widthBytes; x += bytesPerPixel)
{
red += ReadChannel(&pixel[x], mPixelFormat, Adaptor::RED);
green += ReadChannel(&pixel[x], mPixelFormat, Adaptor::GREEN);
* @param [in] height Buffer height in pixels
* @param [in] pixelFormat The pixel format
*/
- static PixelBufferPtr New(unsigned int width,
- unsigned int height,
+ static PixelBufferPtr New(uint32_t width,
+ uint32_t height,
Pixel::Format pixelFormat);
/**
* @param [in] stride Buffer stride in pixels, 0 means the buffer is tightly packed
* @param [in] pixelFormat The pixel format
*/
- static PixelBufferPtr New(unsigned char* buffer,
- unsigned int bufferSize,
- unsigned int width,
- unsigned int height,
- unsigned int stride,
- Pixel::Format pixelFormat);
+ static PixelBufferPtr New(uint8_t* buffer,
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
+ uint32_t stride,
+ Pixel::Format pixelFormat);
/**
* Convert a pixelBuffer object into a PixelData object.
* @param [in] stride Buffer stride in pixels, 0 means the buffer is tightly packed
* @param [in] pixelFormat The pixel format
*/
- PixelBuffer(unsigned char* buffer,
- unsigned int bufferSize,
- unsigned int width,
- unsigned int height,
- unsigned int stride,
- Pixel::Format pixelFormat);
+ PixelBuffer(uint8_t* buffer,
+ uint32_t bufferSize,
+ uint32_t width,
+ uint32_t height,
+ uint32_t stride,
+ Pixel::Format pixelFormat);
protected:
/**
* Get the width of the buffer in pixels.
* @return The width of the buffer in pixels
*/
- unsigned int GetWidth() const;
+ uint32_t GetWidth() const;
/**
* Get the height of the buffer in pixels
* @return The height of the buffer in pixels
*/
- unsigned int GetHeight() const;
+ uint32_t GetHeight() const;
/**
* @brief Gets the stride of the buffer in pixels.
* @return The stride of the buffer in pixels. 0 means the buffer is tightly packed.
*/
- unsigned int GetStride() const;
+ uint32_t GetStride() const;
/**
* Get the pixel format
* Get the pixel buffer if it's present.
* @return The buffer if exists, or NULL if there is no pixel buffer.
*/
- unsigned char* GetBuffer() const;
+ uint8_t* GetBuffer() const;
/**
* @copydoc Devel::PixelBuffer::GetBuffer()
*/
- const unsigned char* const GetConstBuffer() const;
+ const uint8_t* GetConstBuffer() const;
/**
* Get the size of the buffer in bytes
* @return The size of the buffer
*/
- unsigned int GetBufferSize() const;
+ uint32_t GetBufferSize() const;
/**
* Copy the buffer into a new PixelData
{
}
-EncodedImageBuffer::EncodedImageBuffer(const EncodedImageBuffer& handle)
-: BaseHandle(handle)
-{
-}
+EncodedImageBuffer::EncodedImageBuffer(const EncodedImageBuffer& handle) = default;
+
+EncodedImageBuffer& EncodedImageBuffer::operator=(const EncodedImageBuffer& handle) = default;
+
+EncodedImageBuffer::EncodedImageBuffer(EncodedImageBuffer&& handle) = default;
+
+EncodedImageBuffer& EncodedImageBuffer::operator=(EncodedImageBuffer&& handle) = default;
const EncodedImageBuffer::RawBufferType& EncodedImageBuffer::GetRawBuffer() const
{
return GetImplementation(*this).GetHash();
}
-EncodedImageBuffer& EncodedImageBuffer::operator=(const EncodedImageBuffer& handle)
-{
- BaseHandle::operator=(handle);
- return *this;
-}
-
EncodedImageBuffer EncodedImageBuffer::New(const RawBufferType& buffer)
{
IntrusivePtr<Internal::EncodedImageBuffer> internal = Internal::EncodedImageBuffer::New(buffer);
EncodedImageBuffer& operator=(const EncodedImageBuffer& handle);
/**
+ * @brief This move constructor is required for (smart) pointer semantics.
+ *
+ * @param [in] handle A reference to the moved handle
+ */
+ EncodedImageBuffer(EncodedImageBuffer&& handle);
+
+ /**
+ * @brief This move assignment operator is required for (smart) pointer semantics.
+ *
+ * @param [in] handle A reference to the moved handle
+ * @return A reference to this
+ */
+ EncodedImageBuffer& operator=(EncodedImageBuffer&& handle);
+
+ /**
* @brief Get raw buffer data
* @note this method return const value. Mean, you cannot change raw buffer
* @return A RawBufferType this buffer have