diff options
author | Adam Bialogonski <adam.b@samsung.com> | 2024-08-16 08:43:26 +0100 |
---|---|---|
committer | Adam Bialogonski <adam.b@samsung.com> | 2024-08-16 08:43:26 +0100 |
commit | 43b87d4a38c92b3f9fc7814f2a6b4602560e4d49 (patch) | |
tree | eb620314f0cf3c7b86b8659571e10d995a3cd427 /dali | |
parent | f5fa2a0aff0ebc5a1b718d03cd1341c8f344c441 (diff) | |
parent | aa25408542c93dca0266f984797963d92e94b5c4 (diff) | |
download | dali-adaptor-master.tar.gz dali-adaptor-master.tar.bz2 dali-adaptor-master.zip |
Change-Id: Ie44b2b9dfd6840cb56cfad9bcf8bed7e54bb561c
Diffstat (limited to 'dali')
39 files changed, 557 insertions, 104 deletions
diff --git a/dali/devel-api/adaptor-framework/actor-accessible.cpp b/dali/devel-api/adaptor-framework/actor-accessible.cpp index 9a82d1387..13cb945f1 100644 --- a/dali/devel-api/adaptor-framework/actor-accessible.cpp +++ b/dali/devel-api/adaptor-framework/actor-accessible.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021 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. @@ -48,6 +48,11 @@ std::string ActorAccessible::GetDescription() const return {}; } +std::string ActorAccessible::GetValue() const +{ + return {}; +} + Accessible* ActorAccessible::GetParent() { if(IsOnRootLevel()) diff --git a/dali/devel-api/adaptor-framework/actor-accessible.h b/dali/devel-api/adaptor-framework/actor-accessible.h index c885e6d3f..e7d26fb50 100644 --- a/dali/devel-api/adaptor-framework/actor-accessible.h +++ b/dali/devel-api/adaptor-framework/actor-accessible.h @@ -2,7 +2,7 @@ #define DALI_ADAPTOR_ACTOR_ACCESSIBLE_H /* - * Copyright (c) 2021 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. @@ -50,6 +50,11 @@ public: std::string GetDescription() const override; /** + * @copydoc Dali::Accessibility::Accessible::GetValue() + */ + std::string GetValue() const override; + + /** * @copydoc Dali::Accessibility::Accessible::GetParent() */ Accessible* GetParent() final; diff --git a/dali/devel-api/adaptor-framework/image-loading.cpp b/dali/devel-api/adaptor-framework/image-loading.cpp index a552b618e..2c345346a 100644 --- a/dali/devel-api/adaptor-framework/image-loading.cpp +++ b/dali/devel-api/adaptor-framework/image-loading.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -39,7 +39,7 @@ Devel::PixelBuffer LoadImageFromFile(const std::string& url, ImageDimensions siz Internal::Platform::FileReader fileReader(url); FILE* const fp = fileReader.GetFile(); - if(fp != NULL) + if(DALI_LIKELY(fp != NULL)) { Dali::Devel::PixelBuffer bitmap; bool success = TizenPlatform::ImageLoader::ConvertStreamToBitmap(resourceType, url, fp, bitmap); @@ -48,6 +48,10 @@ Devel::PixelBuffer LoadImageFromFile(const std::string& url, ImageDimensions siz return bitmap; } } + else + { + DALI_LOG_ERROR("Error reading file\n"); + } return Dali::Devel::PixelBuffer(); } @@ -57,10 +61,14 @@ void LoadImagePlanesFromFile(const std::string& url, std::vector<Devel::PixelBuf Internal::Platform::FileReader fileReader(url); FILE* const fp = fileReader.GetFile(); - if(fp != NULL) + if(DALI_LIKELY(fp != NULL)) { TizenPlatform::ImageLoader::ConvertStreamToPlanes(resourceType, url, fp, buffers); } + else + { + DALI_LOG_ERROR("Error reading file\n"); + } } Devel::PixelBuffer LoadImageFromBuffer(const Dali::Vector<uint8_t>& buffer, ImageDimensions size, FittingMode::Type fittingMode, SamplingMode::Type samplingMode, bool orientationCorrection) @@ -74,7 +82,7 @@ Devel::PixelBuffer LoadImageFromBuffer(const Dali::Vector<uint8_t>& buffer, Imag Internal::Platform::FileReader fileReader(buffer); FILE* const fp = fileReader.GetFile(); - if(fp != NULL) + if(DALI_LIKELY(fp != NULL)) { Dali::Devel::PixelBuffer bitmap; // Make path as empty string. Path information just for file format hint. @@ -84,6 +92,10 @@ Devel::PixelBuffer LoadImageFromBuffer(const Dali::Vector<uint8_t>& buffer, Imag return bitmap; } } + else + { + DALI_LOG_ERROR("Error reading file\n"); + } return Dali::Devel::PixelBuffer(); } @@ -98,7 +110,7 @@ Devel::PixelBuffer LoadImageFromBuffer(uint8_t* buffer, size_t bufferSize, Image Internal::Platform::FileReader fileReader(buffer, bufferSize); FILE* const fp = fileReader.GetFile(); - if(fp != NULL) + if(DALI_LIKELY(fp != NULL)) { Dali::Devel::PixelBuffer bitmap; // Make path as empty string. Path information just for file format hint. @@ -108,6 +120,10 @@ Devel::PixelBuffer LoadImageFromBuffer(uint8_t* buffer, size_t bufferSize, Image return bitmap; } } + else + { + DALI_LOG_ERROR("Error reading file\n"); + } return Dali::Devel::PixelBuffer(); } @@ -142,14 +158,13 @@ Devel::PixelBuffer DownloadImageSynchronously(const std::string& url, ImageDimen if(succeeded) { size_t blobSize = dataBuffer.Size(); - DALI_ASSERT_DEBUG(blobSize > 0U); - if(blobSize > 0U) + if(DALI_LIKELY(blobSize > 0U)) { // Open a file handle on the memory buffer: Dali::Internal::Platform::FileReader fileReader(dataBuffer, blobSize); FILE* const fp = fileReader.GetFile(); - if(NULL != fp) + if(DALI_LIKELY(NULL != fp)) { Dali::Devel::PixelBuffer bitmap; bool result = TizenPlatform::ImageLoader::ConvertStreamToBitmap( @@ -167,7 +182,19 @@ Devel::PixelBuffer DownloadImageSynchronously(const std::string& url, ImageDimen DALI_LOG_WARNING("Unable to decode bitmap supplied as in-memory blob.\n"); } } + else + { + DALI_LOG_ERROR("Error reading file\n"); + } } + else + { + DALI_LOG_ERROR("Error download empty buffer!\n"); + } + } + else + { + DALI_LOG_ERROR("Error download failed!\n"); } return Dali::Devel::PixelBuffer(); } diff --git a/dali/devel-api/adaptor-framework/proxy-accessible.h b/dali/devel-api/adaptor-framework/proxy-accessible.h index 35aaf45ab..830de16a7 100644 --- a/dali/devel-api/adaptor-framework/proxy-accessible.h +++ b/dali/devel-api/adaptor-framework/proxy-accessible.h @@ -2,7 +2,7 @@ #define DALI_ADAPTOR_PROXY_ACCESSIBLE_H /* - * Copyright (c) 2021 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. @@ -64,6 +64,11 @@ public: return ""; } + std::string GetValue() const override + { + return ""; + } + Accessible* GetParent() override { return mParent; diff --git a/dali/devel-api/adaptor-framework/video-player-plugin.h b/dali/devel-api/adaptor-framework/video-player-plugin.h index d1d4c129b..6783e75ff 100644 --- a/dali/devel-api/adaptor-framework/video-player-plugin.h +++ b/dali/devel-api/adaptor-framework/video-player-plugin.h @@ -320,6 +320,18 @@ public: * @return The return of native surface pointer of video player */ virtual Any GetVideoPlayerSurface() = 0; + + /** + * @brief Video View has video player is connected to Window's Scene. + * + */ + virtual void SceneConnection() = 0; + + /** + * @brief Video View has video player is disconnected to Window's Scene. + * + */ + virtual void SceneDisconnection() = 0; }; } // namespace Dali diff --git a/dali/devel-api/adaptor-framework/video-player.cpp b/dali/devel-api/adaptor-framework/video-player.cpp index 597ad02cd..018eb958a 100644 --- a/dali/devel-api/adaptor-framework/video-player.cpp +++ b/dali/devel-api/adaptor-framework/video-player.cpp @@ -237,4 +237,14 @@ void VideoPlayer::LowerToBottom() GetImplementation(*this).LowerToBottom(); } +void VideoPlayer::SceneConnection() +{ + GetImplementation(*this).SceneConnection(); +} + +void VideoPlayer::SceneDisconnection() +{ + GetImplementation(*this).SceneDisconnection(); +} + } // namespace Dali diff --git a/dali/devel-api/adaptor-framework/video-player.h b/dali/devel-api/adaptor-framework/video-player.h index 8af206e98..91eee48e9 100644 --- a/dali/devel-api/adaptor-framework/video-player.h +++ b/dali/devel-api/adaptor-framework/video-player.h @@ -340,6 +340,16 @@ public: */ void LowerToBottom(); + /** + * @brief Video View has video player is connected to Window's Scene. + */ + void SceneConnection(); + + /** + * @brief Video View has video player is disconnected to Window's Scene. + */ + void SceneDisconnection(); + private: // Not intended for application developers /** * @brief Internal constructor diff --git a/dali/devel-api/atspi-interfaces/accessible.h b/dali/devel-api/atspi-interfaces/accessible.h index 476fbe69b..5398994d9 100644 --- a/dali/devel-api/atspi-interfaces/accessible.h +++ b/dali/devel-api/atspi-interfaces/accessible.h @@ -180,6 +180,13 @@ public: virtual std::string GetDescription() const = 0; /** + * @brief Gets accessibility value. + * + * @return The value text + */ + virtual std::string GetValue() const = 0; + + /** * @brief Gets parent. * * @return The handler to accessibility object diff --git a/dali/devel-api/text-abstraction/bidirectional-support.cpp b/dali/devel-api/text-abstraction/bidirectional-support.cpp index 4d7279cff..3ff069f76 100644 --- a/dali/devel-api/text-abstraction/bidirectional-support.cpp +++ b/dali/devel-api/text-abstraction/bidirectional-support.cpp @@ -43,6 +43,13 @@ BidirectionalSupport BidirectionalSupport::Get() return Internal::BidirectionalSupport::Get(); } +BidirectionalSupport BidirectionalSupport::New() +{ + auto bidirectionalSupportImpl = new Internal::BidirectionalSupport(); + + return BidirectionalSupport(bidirectionalSupportImpl); +} + BidiInfoIndex BidirectionalSupport::CreateInfo(const Character* const paragraph, Length numberOfCharacters, bool matchLayoutDirection, diff --git a/dali/devel-api/text-abstraction/bidirectional-support.h b/dali/devel-api/text-abstraction/bidirectional-support.h index d76a2bdba..80b65b405 100644 --- a/dali/devel-api/text-abstraction/bidirectional-support.h +++ b/dali/devel-api/text-abstraction/bidirectional-support.h @@ -69,10 +69,20 @@ public: * @brief Retrieve a handle to the BidirectionalSupport instance. * * @return A handle to the BidirectionalSupport + * @remarks A reference to the singleton instance of BidirectionalSupport. */ static BidirectionalSupport Get(); /** + * @brief Create a handle to the new BidirectionalSupport instance. + * + * @return A handle to the BidirectionalSupport. + * @remarks All functions of this are not thread-safe, + * so create new handles for each worker thread to utilize them. + */ + static BidirectionalSupport New(); + + /** * @brief Creates bidirectional data for the whole paragraph. * * @param[in] paragraph Pointer to the first character of the paragraph coded in UTF32. diff --git a/dali/devel-api/text-abstraction/font-client.cpp b/dali/devel-api/text-abstraction/font-client.cpp index 10e23d3f4..95845cd96 100644 --- a/dali/devel-api/text-abstraction/font-client.cpp +++ b/dali/devel-api/text-abstraction/font-client.cpp @@ -82,6 +82,15 @@ FontClient FontClient::Get() return Internal::FontClient::Get(); } +FontClient FontClient::New() +{ + auto fontClientImpl = new Internal::FontClient(); + + fontClientImpl->SetDpiFromWindowSystem(); + + return FontClient(fontClientImpl); +} + FontClient FontClient::New(uint32_t horizontalDpi, uint32_t verticalDpi) { auto fontClientImpl = new Internal::FontClient(); @@ -122,6 +131,11 @@ void FontClient::SetDpi(unsigned int horizontalDpi, unsigned int verticalDpi) GetImplementation(*this).SetDpi(horizontalDpi, verticalDpi); } +void FontClient::SetDpiFromWindowSystem() +{ + GetImplementation(*this).SetDpiFromWindowSystem(); +} + void FontClient::GetDpi(unsigned int& horizontalDpi, unsigned int& verticalDpi) { GetImplementation(*this).GetDpi(horizontalDpi, verticalDpi); @@ -284,6 +298,11 @@ bool FontClient::AddCustomFontDirectory(const FontPath& path) return GetImplementation(*this).AddCustomFontDirectory(path); } +void FontClient::ApplyCustomFontDirectories() +{ + GetImplementation(*this).ApplyCustomFontDirectories(); +} + GlyphIndex FontClient::CreateEmbeddedItem(const EmbeddedItemDescription& description, Pixel::Format& pixelFormat) { return GetImplementation(*this).CreateEmbeddedItem(description, pixelFormat); diff --git a/dali/devel-api/text-abstraction/font-client.h b/dali/devel-api/text-abstraction/font-client.h index 61647ec1b..4ce027e23 100644 --- a/dali/devel-api/text-abstraction/font-client.h +++ b/dali/devel-api/text-abstraction/font-client.h @@ -99,15 +99,27 @@ public: * @brief Retrieve a handle to the FontClient instance. * * @return A handle to the FontClient + * @remarks A reference to the singleton instance of FontClient. */ static FontClient Get(); /** * @brief Create a handle to the new FontClient instance. * + * @return A handle to the FontClient + * @remarks All functions of this are not thread-safe, + * so create new handles for each worker thread to utilize them. + */ + static FontClient New(); + + /** + * @brief Create a handle to the new FontClient instance. + * * @param[in] horizontalDpi The horizontal resolution in DPI. * @param[in] verticalDpi The vertical resolution in DPI. * @return A handle to the FontClient + * @remarks All functions of this are not thread-safe, + * so create new handles for each worker thread to utilize them. */ static FontClient New(uint32_t horizontalDpi, uint32_t verticalDpi); @@ -180,6 +192,13 @@ public: void SetDpi(unsigned int horizontalDpi, unsigned int verticalDpi); /** + * @brief Sets the DPI of the FontClient based on the current window's DPI. + * + * @note Multiple windows are not currently supported. + */ + void SetDpiFromWindowSystem(); + + /** * @brief Retrieves the DPI previously set to the target window. * * @note Multiple windows are not currently supported. @@ -495,6 +514,11 @@ public: bool AddCustomFontDirectory(const FontPath& path); /** + * @brief Apply custom fonts directories + */ + void ApplyCustomFontDirectories(); + + /** * @brief Creates and stores an embedded item and it's metrics. * * If in the @p description there is a non empty url, it calls Dali::LoadImageFromFile() internally. diff --git a/dali/devel-api/text-abstraction/hyphenation.cpp b/dali/devel-api/text-abstraction/hyphenation.cpp index 40a0da40f..579db0009 100644 --- a/dali/devel-api/text-abstraction/hyphenation.cpp +++ b/dali/devel-api/text-abstraction/hyphenation.cpp @@ -43,6 +43,13 @@ Hyphenation Hyphenation::Get() return Internal::Hyphenation::Get(); } +Hyphenation Hyphenation::New() +{ + auto hyphenationImpl = new Internal::Hyphenation(); + + return Hyphenation(hyphenationImpl); +} + const char* Hyphenation::GetDictionaryEncoding(const char* lang) { return GetImplementation(*this).GetDictionaryEncoding(lang); diff --git a/dali/devel-api/text-abstraction/hyphenation.h b/dali/devel-api/text-abstraction/hyphenation.h index b8d5cfe74..d7190ce49 100644 --- a/dali/devel-api/text-abstraction/hyphenation.h +++ b/dali/devel-api/text-abstraction/hyphenation.h @@ -79,10 +79,20 @@ public: * @brief Retrieve a handle to the Hyphenation instance. * * @return A handle to the Hyphenation. + * @remarks A reference to the singleton instance of Hyphenation. */ static Hyphenation Get(); /** + * @brief Create a handle to the new Hyphenation instance. + * + * @return A handle to the Hyphenation. + * @remarks All functions of this are not thread-safe, + * so create new handles for each worker thread to utilize them. + */ + static Hyphenation New(); + + /** * * Gets the encoding of the dictionary for the given language * diff --git a/dali/devel-api/text-abstraction/segmentation.cpp b/dali/devel-api/text-abstraction/segmentation.cpp index fa5a01b18..8436ca540 100644 --- a/dali/devel-api/text-abstraction/segmentation.cpp +++ b/dali/devel-api/text-abstraction/segmentation.cpp @@ -43,6 +43,13 @@ Segmentation Segmentation::Get() return Internal::Segmentation::Get(); } +Segmentation Segmentation::New() +{ + auto segmentationImpl = new Internal::Segmentation(); + + return Segmentation(segmentationImpl); +} + void Segmentation::GetLineBreakPositions(const Character* const text, Length numberOfCharacters, LineBreakInfo* breakInfo) diff --git a/dali/devel-api/text-abstraction/segmentation.h b/dali/devel-api/text-abstraction/segmentation.h index 42df64f0a..6023e3eaa 100644 --- a/dali/devel-api/text-abstraction/segmentation.h +++ b/dali/devel-api/text-abstraction/segmentation.h @@ -70,10 +70,20 @@ public: * @brief Retrieve a handle to the Segmentation instance. * * @return A handle to the Segmentation + * @remarks A reference to the singleton instance of Segmentation. */ static Segmentation Get(); /** + * @brief Create a handle to the new Segmentation instance. + * + * @return A handle to the Segmentation. + * @remarks All functions of this are not thread-safe, + * so create new handles for each worker thread to utilize them. + */ + static Segmentation New(); + + /** * @brief Retrieves the line break info. * * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters. diff --git a/dali/devel-api/text-abstraction/shaping.cpp b/dali/devel-api/text-abstraction/shaping.cpp index 3d9f541ac..5fa10f526 100644 --- a/dali/devel-api/text-abstraction/shaping.cpp +++ b/dali/devel-api/text-abstraction/shaping.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020 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. @@ -43,12 +43,21 @@ Shaping Shaping::Get() return Internal::Shaping::Get(); } -Length Shaping::Shape(const Character* const text, - Length numberOfCharacters, - FontId fontId, - Script script) +Shaping Shaping::New() { - return GetImplementation(*this).Shape(text, + auto shapingImpl = new Internal::Shaping(); + + return Shaping(shapingImpl); +} + +Length Shaping::Shape(TextAbstraction::FontClient& fontClient, + const Character* const text, + Length numberOfCharacters, + FontId fontId, + Script script) +{ + return GetImplementation(*this).Shape(fontClient, + text, numberOfCharacters, fontId, script); diff --git a/dali/devel-api/text-abstraction/shaping.h b/dali/devel-api/text-abstraction/shaping.h index 8dd705362..c7fe312a7 100644 --- a/dali/devel-api/text-abstraction/shaping.h +++ b/dali/devel-api/text-abstraction/shaping.h @@ -2,7 +2,7 @@ #define DALI_PLATFORM_TEXT_ABSTRACTION_SHAPING_H /* - * Copyright (c) 2020 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/text-abstraction/emoji-helper.h> +#include <dali/devel-api/text-abstraction/font-client.h> #include <dali/devel-api/text-abstraction/script.h> #include <dali/devel-api/text-abstraction/text-abstraction-definitions.h> @@ -85,14 +86,25 @@ public: * @brief Retrieve a handle to the Shaping instance. * * @return A handle to the Shaping. + * @remarks A reference to the singleton instance of Shaping. */ static Shaping Get(); /** + * @brief Create a handle to the new Shaping instance. + * + * @return A handle to the Shaping. + * @remarks All functions of this are not thread-safe, + * so create new handles for each worker thread to utilize them. + */ + static Shaping New(); + + /** * Shapes the text. * * Call GetGlyphs() to retrieve the glyphs. * + * @param[in] fontClient FontClient to use in this function. * @param[in] text Pointer to the first character of the text coded in UTF32. * @param[in] numberOfCharacters The number of characters to be shaped * @param[in] fontId The font to be used to shape the text. @@ -100,10 +112,11 @@ public: * * @return The size of the buffer required to get the shaped text. */ - Length Shape(const Character* const text, - Length numberOfCharacters, - FontId fontId, - Script script); + Length Shape(TextAbstraction::FontClient& fontClient, + const Character* const text, + Length numberOfCharacters, + FontId fontId, + Script script); /** * Gets the shaped text data. diff --git a/dali/internal/accessibility/bridge/bridge-accessible.cpp b/dali/internal/accessibility/bridge/bridge-accessible.cpp index c57a887c4..344d96800 100644 --- a/dali/internal/accessibility/bridge/bridge-accessible.cpp +++ b/dali/internal/accessibility/bridge/bridge-accessible.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023 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. @@ -41,6 +41,9 @@ using namespace Dali::Accessibility; namespace { +constexpr const char* VALUE_FORMAT_KEY = "value_format"; +constexpr const char* VALUE_FORMAT_TEXT_VAL = "text"; + bool SortVertically(Component* lhs, Component* rhs) { auto leftRect = lhs->GetExtents(CoordinateType::WINDOW); @@ -488,8 +491,9 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial() std::string labeledByName = labellingObject ? labellingObject->GetName() : ""; auto describedByObject = findObjectByRelationType(RelationType::DESCRIBED_BY); + auto attributes = self->GetAttributes(); - double currentValue = 0.0; + double currentValue = 0.0; std::string currentValueText; double minimumIncrement = 0.0; double maximumValue = 0.0; @@ -503,6 +507,15 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial() maximumValue = valueInterface->GetMaximum(); minimumValue = valueInterface->GetMinimum(); } + else + { + // value text support outside of IAtspiValue interface + currentValueText = self->GetValue(); + if(!currentValueText.empty()) + { + attributes.insert({VALUE_FORMAT_KEY, VALUE_FORMAT_TEXT_VAL}); + } + } int32_t firstSelectedChildIndex = -1; int32_t selectedChildCount = 0; @@ -529,7 +542,6 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial() } } - auto attributes = self->GetAttributes(); auto itemCount = attributes.find("item_count"); auto atspiRole = self->GetRole(); int32_t listChildrenCount = 0; @@ -602,23 +614,23 @@ BridgeAccessible::ReadingMaterialType BridgeAccessible::GetReadingMaterial() BridgeAccessible::NodeInfoType BridgeAccessible::GetNodeInfo() { - auto self = FindSelf(); - auto roleName = self->GetRoleName(); - auto name = self->GetName(); - auto toolkitName = "dali"; - auto attributes = self->GetAttributes(); - auto states = self->GetStates(); - - auto* component = Component::DownCast(self); + auto self = FindSelf(); + auto roleName = self->GetRoleName(); + auto name = self->GetName(); + auto toolkitName = "dali"; + auto attributes = self->GetAttributes(); + auto states = self->GetStates(); + + auto* component = Component::DownCast(self); Dali::Rect<> screenExtents = {0, 0, 0, 0}; Dali::Rect<> windowExtents = {0, 0, 0, 0}; - if (component) + if(component) { screenExtents = component->GetExtents(CoordinateType::SCREEN); windowExtents = component->GetExtents(CoordinateType::WINDOW); } - auto* valueInterface = Value::DownCast(self); + auto* valueInterface = Value::DownCast(self); double currentValue = 0.0; double minimumIncrement = 0.0; double maximumValue = 0.0; diff --git a/dali/internal/accessibility/bridge/bridge-base.h b/dali/internal/accessibility/bridge/bridge-base.h index 2cfcab094..cc3d6136c 100644 --- a/dali/internal/accessibility/bridge/bridge-base.h +++ b/dali/internal/accessibility/bridge/bridge-base.h @@ -58,7 +58,12 @@ public: std::string GetDescription() const override { - return ""; + return {}; + } + + std::string GetValue() const override + { + return {}; } Dali::Accessibility::Accessible* GetParent() override diff --git a/dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp b/dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp index 5766dc744..65991ee11 100644 --- a/dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp +++ b/dali/internal/graphics/gles-impl/gles-graphics-reflection.cpp @@ -57,7 +57,7 @@ struct StringSize bool operator==(const StringSize& lhs, const char* rhs) { - return strncmp(lhs.mString, rhs, lhs.mLength) == 0; + return strncmp(lhs.mString, rhs, lhs.mLength + 0 /* Compare prefix only */) == 0; } const char* const DELIMITERS = " \t\n"; @@ -170,7 +170,7 @@ void ParseShaderSamplers(std::string shaderSource, std::vector<Dali::Graphics::U for(uint32_t i = 0; i < static_cast<uint32_t>(uniformOpaques.size()); ++i) { if(samplerPositions[i] == -1 && - strncmp(token, uniformOpaques[i].name.c_str(), uniformOpaques[i].name.size()) == 0) + strncmp(token, uniformOpaques[i].name.c_str(), uniformOpaques[i].name.size() + 1 /* Compare include null-terminated char */) == 0) { // We have found a matching name. samplerPositions[i] = uniformOpaques[i].offset = samplerPosition; @@ -419,7 +419,7 @@ void Reflection::BuildUniformBlockReflection() auto& member = block.members[memberIndex]; if(member.elementCount > 0) { - member.elementStride = (block.members[memberIndex+1].offset - member.offset) / member.elementCount; + member.elementStride = (block.members[memberIndex + 1].offset - member.offset) / member.elementCount; } } } @@ -532,7 +532,7 @@ bool Reflection::GetUniformBlock(uint32_t index, Dali::Graphics::UniformBlockInf out.size = block.size; for(auto i = 0u; i < out.members.size(); ++i) { - const auto& memberUniform = block.members[i]; + const auto& memberUniform = block.members[i]; out.members[i].name = memberUniform.name; out.members[i].binding = block.binding; out.members[i].uniformClass = Graphics::UniformClass::UNIFORM; diff --git a/dali/internal/graphics/vulkan/vulkan-device.cpp b/dali/internal/graphics/vulkan/vulkan-device.cpp index 2eaf3f1c4..19ffa2f47 100644 --- a/dali/internal/graphics/vulkan/vulkan-device.cpp +++ b/dali/internal/graphics/vulkan/vulkan-device.cpp @@ -686,6 +686,17 @@ void Device::PreparePhysicalDevice() GetPhysicalDeviceProperties(); GetQueueFamilyProperties(); + + Integration::Log::LogMessage(Integration::Log::INFO, + "Vulkan information:\n" + " Vulkan version: %d.%d.%d\n" + " Device name: %s\n" + " Driver Version: %x\n", + VK_API_VERSION_MAJOR(mPhysicalDeviceProperties.apiVersion), + VK_API_VERSION_MINOR(mPhysicalDeviceProperties.apiVersion), + VK_API_VERSION_PATCH(mPhysicalDeviceProperties.apiVersion), + (const char*)mPhysicalDeviceProperties.deviceName, + mPhysicalDeviceProperties.driverVersion); } void Device::GetPhysicalDeviceProperties() @@ -880,8 +891,7 @@ vk::Result Device::Submit(Queue& queue, const std::vector<SubmissionData>& submi std::transform(subData.commandBuffers.cbegin(), subData.commandBuffers.cend(), std::back_inserter(commandBufferHandles), - [&](CommandBufferImpl* entry) - { + [&](CommandBufferImpl* entry) { return entry->GetVkHandle(); }); diff --git a/dali/internal/imaging/common/gif-loading.cpp b/dali/internal/imaging/common/gif-loading.cpp index c35899aec..06723bb69 100644 --- a/dali/internal/imaging/common/gif-loading.cpp +++ b/dali/internal/imaging/common/gif-loading.cpp @@ -299,17 +299,20 @@ bool LoaderInfo::FileData::LoadLocalFile() FILE* fp = fileReader.GetFile(); if(DALI_UNLIKELY(fp == NULL)) { + DALI_LOG_ERROR("Error reading file\n"); return false; } if(DALI_UNLIKELY(fseek(fp, 0, SEEK_END) <= -1)) { + DALI_LOG_ERROR("Error seeking within file\n"); return false; } length = ftell(fp); if(DALI_UNLIKELY(length <= -1)) { + DALI_LOG_ERROR("Could not determine GIF file size.\n"); return false; } @@ -325,6 +328,7 @@ bool LoaderInfo::FileData::LoadLocalFile() } else { + DALI_LOG_ERROR("Error seeking within file\n"); return false; } return true; @@ -371,6 +375,14 @@ bool LoaderInfo::FileData::LoadRemoteFile() DALI_LOG_ERROR("Error reading file\n"); } } + else + { + DALI_LOG_ERROR("Error download empty buffer!\n"); + } + } + else + { + DALI_LOG_ERROR("Error download failed!\n"); } return succeeded; diff --git a/dali/internal/imaging/common/image-loader.cpp b/dali/internal/imaging/common/image-loader.cpp index b19b3a75b..081b3f714 100644 --- a/dali/internal/imaging/common/image-loader.cpp +++ b/dali/internal/imaging/common/image-loader.cpp @@ -176,7 +176,7 @@ bool GetBitmapLoaderFunctions(FILE* fp, size_t read = fread(magic, sizeof(unsigned char), MAGIC_LENGTH, fp); // Reset to the start of the file. - if(fseek(fp, 0, SEEK_SET)) + if(DALI_UNLIKELY(fseek(fp, 0, SEEK_SET))) { DALI_LOG_ERROR("Error seeking to start of file\n"); } @@ -262,7 +262,7 @@ bool GetBitmapLoaderFunctions(FILE* fp, } // Reset to the start of the file. - if(fseek(fp, 0, SEEK_SET)) + if(DALI_UNLIKELY(fseek(fp, 0, SEEK_SET))) { DALI_LOG_ERROR("Error seeking to start of file\n"); } @@ -280,7 +280,7 @@ bool ConvertStreamToBitmap(const BitmapResourceType& resource, const std::string bool result = false; - if(fp != NULL) + if(DALI_LIKELY(fp != NULL)) { Dali::ImageLoader::LoadBitmapFunction function; Dali::ImageLoader::LoadPlanesFunction planeLoader; @@ -315,6 +315,10 @@ bool ConvertStreamToBitmap(const BitmapResourceType& resource, const std::string DALI_LOG_ERROR("Image Decoder for %s unavailable\n", path.c_str()); } } + else + { + DALI_LOG_ERROR("Error reading file\n"); + } return result; } @@ -325,7 +329,7 @@ bool ConvertStreamToPlanes(const Integration::BitmapResourceType& resource, cons bool result = false; - if(fp != NULL) + if(DALI_LIKELY(fp != NULL)) { Dali::ImageLoader::LoadBitmapFunction loader; Dali::ImageLoader::LoadPlanesFunction planeLoader; @@ -399,6 +403,10 @@ bool ConvertStreamToPlanes(const Integration::BitmapResourceType& resource, cons DALI_LOG_ERROR("Image Decoder for %s unavailable\n", path.c_str()); } } + else + { + DALI_LOG_ERROR("Error reading file\n"); + } return result; } @@ -410,7 +418,7 @@ ResourcePointer LoadImageSynchronously(const Integration::BitmapResourceType& re Internal::Platform::FileReader fileReader(path); FILE* const fp = fileReader.GetFile(); - if(fp != NULL) + if(DALI_LIKELY(fp != NULL)) { bool success = ConvertStreamToBitmap(resource, path, fp, bitmap); if(success && bitmap) @@ -435,6 +443,10 @@ ResourcePointer LoadImageSynchronously(const Integration::BitmapResourceType& re result.Reset(retval); } } + else + { + DALI_LOG_ERROR("Error reading file\n"); + } return result; } @@ -458,7 +470,7 @@ ImageDimensions GetClosestImageSize(const std::string& filename, Internal::Platform::FileReader fileReader(filename); FILE* fp = fileReader.GetFile(); - if(fp != NULL) + if(DALI_LIKELY(fp != NULL)) { Dali::ImageLoader::LoadBitmapFunction loaderFunction; Dali::ImageLoader::LoadPlanesFunction planeLoader; @@ -486,6 +498,10 @@ ImageDimensions GetClosestImageSize(const std::string& filename, DALI_LOG_ERROR("Image Decoder for %s unavailable\n", filename.c_str()); } } + else + { + DALI_LOG_ERROR("Error reading file for %s\n", filename.c_str()); + } return ImageDimensions(width, height); } @@ -502,14 +518,14 @@ ImageDimensions GetClosestImageSize(Integration::ResourcePointer resourceBuffer, DALI_ASSERT_DEBUG(resourceBuffer); Dali::RefCountedVector<uint8_t>* const encodedBlob = reinterpret_cast<Dali::RefCountedVector<uint8_t>*>(resourceBuffer.Get()); - if(encodedBlob != 0) + if(DALI_LIKELY(encodedBlob != 0)) { - if(encodedBlob->GetVector().Size()) + if(DALI_LIKELY(encodedBlob->GetVector().Size())) { // Open a file handle on the memory buffer: Internal::Platform::FileReader fileReader(encodedBlob->GetVector()); FILE* fp = fileReader.GetFile(); - if(fp != NULL) + if(DALI_LIKELY(fp != NULL)) { Dali::ImageLoader::LoadBitmapFunction loaderFunction; Dali::ImageLoader::LoadPlanesFunction planeLoader; @@ -531,8 +547,24 @@ ImageDimensions GetClosestImageSize(Integration::ResourcePointer resourceBuffer, DALI_LOG_ERROR("Image Decoder failed to read header for resourceBuffer\n"); } } + else + { + DALI_LOG_ERROR("Image Decoder unavailable\n"); + } + } + else + { + DALI_LOG_ERROR("Error reading file\n"); } } + else + { + DALI_LOG_ERROR("Image Buffer is empty size\n"); + } + } + else + { + DALI_LOG_ERROR("Image Buffer is nullptr\n"); } return ImageDimensions(width, height); } diff --git a/dali/internal/imaging/common/loader-ico.cpp b/dali/internal/imaging/common/loader-ico.cpp index b23eaeed9..b7d79b3e9 100644 --- a/dali/internal/imaging/common/loader-ico.cpp +++ b/dali/internal/imaging/common/loader-ico.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -188,6 +188,7 @@ bool LoadIcoHeaderHelper(FILE* fp, if(DALI_UNLIKELY(0u == fsize)) { + DALI_LOG_ERROR("Error ICO data size is zero!\n"); return false; } @@ -199,6 +200,7 @@ bool LoadIcoHeaderHelper(FILE* fp, if(DALI_UNLIKELY(fsize < (ICO_FILE_HEADER + ICO_IMAGE_INFO_HEADER))) //6 + 16 + 40 { + DALI_LOG_ERROR("Error ICO data size is too small! (%ld < %u)!\n", fsize, static_cast<uint32_t>(ICO_FILE_HEADER + ICO_IMAGE_INFO_HEADER)); return false; } map.ResizeUninitialized(fsize); @@ -214,19 +216,23 @@ bool LoadIcoHeaderHelper(FILE* fp, unsigned short reserved, type, count; if(DALI_UNLIKELY(!read_ushort(inputBufferPtr, fsize, &position, &reserved))) { + DALI_LOG_ERROR("Error ICO header.reserved decode failed!\n"); return false; } if(DALI_UNLIKELY(!read_ushort(inputBufferPtr, fsize, &position, &type))) { + DALI_LOG_ERROR("Error ICO header.type decode failed!\n"); return false; } if(DALI_UNLIKELY(!read_ushort(inputBufferPtr, fsize, &position, &count))) { + DALI_LOG_ERROR("Error ICO header.count decode failed!\n"); return false; } if(DALI_UNLIKELY(!((reserved == 0) && ((type == ICON) || (type == CURSOR)) && (count != 0)))) { + DALI_LOG_ERROR("Error ICO header is invalid! (reserved : %hu, type : %hu, count : %hu)\n", reserved, type, count); return false; } search = BIGGEST; @@ -327,6 +333,7 @@ bool LoadIcoHeaderHelper(FILE* fp, if(DALI_UNLIKELY(chosen.bmoffset == 0)) { + DALI_LOG_ERROR("Error ICO data is invalid!\n"); return false; } diff --git a/dali/internal/imaging/common/webp-loading.cpp b/dali/internal/imaging/common/webp-loading.cpp index 24f150650..1a550bfd2 100644 --- a/dali/internal/imaging/common/webp-loading.cpp +++ b/dali/internal/imaging/common/webp-loading.cpp @@ -184,10 +184,18 @@ public: // Open a file handle on the memory buffer: fileReader = std::make_unique<Internal::Platform::FileReader>(dataBuffer, mBufferSize); } + else + { + DALI_LOG_ERROR("Error download empty buffer!\n"); + } + } + else + { + DALI_LOG_ERROR("Error download failed!\n"); } } - if(fileReader) + if(DALI_LIKELY(fileReader)) { fp = fileReader->GetFile(); } @@ -199,6 +207,7 @@ public: { if(DALI_UNLIKELY(fseek(fp, 0, SEEK_END) <= -1)) { + DALI_LOG_ERROR("Error seeking within file\n"); return false; } mBufferSize = ftell(fp); @@ -215,6 +224,14 @@ public: mBufferSize = fread(mBuffer, sizeof(WebPByteType), mBufferSize, fp); return true; } + else + { + DALI_LOG_ERROR("Error seeking within file\n"); + } + } + else + { + DALI_LOG_ERROR("Error reading file\n"); } return false; } diff --git a/dali/internal/network/common/network-performance-protocol.cpp b/dali/internal/network/common/network-performance-protocol.cpp index d921f5824..dd4eb254d 100644 --- a/dali/internal/network/common/network-performance-protocol.cpp +++ b/dali/internal/network/common/network-performance-protocol.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -101,42 +101,51 @@ const char* const helpMsg = GREEN " custom_command " PARAM "ANY_STRING" NORMAL "\n" "\n" GREEN " dump_scene" NORMAL " - dump the current scene in json format\n"; -// clang-format off -} // un-named namespace +// clang-format on -bool GetCommandId( const char* const commandString, unsigned int lengthInBytes, CommandId& commandId, unsigned int& intParam, std::string& stringParam ) +const char* const DELIMITERS = " \t\n"; + +inline bool IsDelimChar(char endOfCommand) +{ + // DevNote : If endOfCommand is \0, it will always return true. + return (strchr(DELIMITERS, endOfCommand) != NULL); +} +} // namespace + +bool GetCommandId(const char* const commandString, unsigned int lengthInBytes, CommandId& commandId, unsigned int& intParam, std::string& stringParam) { commandId = UNKNOWN_COMMAND; - intParam = 0; + intParam = 0; // the command list is small so just do a O(n) search for the commandID. - for( unsigned int i = 0 ; i < CommandLookupLength; ++i ) + for(unsigned int i = 0; i < CommandLookupLength; ++i) { - if( strncmp( commandString, CommandLookup[i].cmdString ,strlen(CommandLookup[i].cmdString )) == 0 ) + auto cmdLength = strlen(CommandLookup[i].cmdString); + if(strncmp(commandString, CommandLookup[i].cmdString, cmdLength) == 0 && IsDelimChar(commandString + cmdLength)) { commandId = CommandLookup[i].cmdId; // if the command has a parameter read it - if( CommandLookup[i].paramType == UNSIGNED_INT) + if(CommandLookup[i].paramType == UNSIGNED_INT) { - int count = sscanf(commandString,"%*s %d",&intParam); - if( count != 1 ) + int count = sscanf(commandString, "%*s %d", &intParam); + if(count != 1) { // missing parameter return false; } } - else if (CommandLookup[i].paramType == STRING ) + else if(CommandLookup[i].paramType == STRING) { - char* charParam( NULL ); + char* charParam(NULL); // allocates the character array - int count = sscanf(commandString,"%*s %ms",&charParam); - if( count != 1 ) + int count = sscanf(commandString, "%*s %ms", &charParam); + if(count != 1) { // missing parameter return false; } - stringParam = std::string( charParam); + stringParam = std::string(charParam); free(charParam); } return true; @@ -146,17 +155,17 @@ bool GetCommandId( const char* const commandString, unsigned int lengthInBytes, return false; } -bool GetCommandString( CommandId commandId, CommandString& commandString ) +bool GetCommandString(CommandId commandId, CommandString& commandString) { - for( unsigned int i = 0; i < CommandLookupLength; ++i) + for(unsigned int i = 0; i < CommandLookupLength; ++i) { - if( CommandLookup[ i ].cmdId == commandId ) + if(CommandLookup[i].cmdId == commandId) { - strncpy( commandString, CommandLookup[ i ].cmdString, strlen(CommandLookup[ i ].cmdString) ); + strncpy(commandString, CommandLookup[i].cmdString, strlen(CommandLookup[i].cmdString) + 1); return true; } } - strncpy( commandString, CommandLookup[ UNKNOWN_COMMAND ].cmdString, MAX_COMMAND_STRING_LENGTH); + strncpy(commandString, CommandLookup[UNKNOWN_COMMAND].cmdString, MAX_COMMAND_STRING_LENGTH); return false; } @@ -165,7 +174,6 @@ const char* const GetHelpMessage() return helpMsg; } - } // namespace PerformanceProtocol } // namespace Dali diff --git a/dali/internal/text/text-abstraction/font-client-impl.cpp b/dali/internal/text/text-abstraction/font-client-impl.cpp index 031c78a81..900ee8385 100644 --- a/dali/internal/text/text-abstraction/font-client-impl.cpp +++ b/dali/internal/text/text-abstraction/font-client-impl.cpp @@ -142,14 +142,7 @@ Dali::TextAbstraction::FontClient FontClient::Get() gFontPreCacheAvailable = false; gFontPreLoadAvailable = false; - uint32_t horizontalDpi, verticalDpi; - fontClientHandle.GetDpi(horizontalDpi, verticalDpi); - if(horizontalDpi == 0u || verticalDpi == 0u) - { - horizontalDpi = verticalDpi = 0u; - Dali::Internal::Adaptor::WindowSystem::GetDpi(horizontalDpi, verticalDpi); - fontClientHandle.SetDpi(horizontalDpi, verticalDpi); - } + fontClientHandle.SetDpiFromWindowSystem(); service.Register(typeid(fontClientHandle), fontClientHandle); } @@ -355,6 +348,16 @@ void FontClient::SetDpi(unsigned int horizontalDpi, unsigned int verticalDpi) } } +void FontClient::SetDpiFromWindowSystem() +{ + if(mDpiHorizontal == 0u || mDpiVertical == 0u) + { + uint32_t horizontalDpi = 0u, verticalDpi = 0u; + Dali::Internal::Adaptor::WindowSystem::GetDpi(horizontalDpi, verticalDpi); + SetDpi(horizontalDpi, verticalDpi); + } +} + void FontClient::GetDpi(unsigned int& horizontalDpi, unsigned int& verticalDpi) { horizontalDpi = mDpiHorizontal; @@ -681,6 +684,13 @@ bool FontClient::AddCustomFontDirectory(const FontPath& path) return mPlugin->AddCustomFontDirectory(path); } +void FontClient::ApplyCustomFontDirectories() +{ + CreatePlugin(); + + return mPlugin->ApplyCustomFontDirectories(); +} + HarfBuzzFontHandle FontClient::GetHarfBuzzFont(FontId fontId) { CreatePlugin(); diff --git a/dali/internal/text/text-abstraction/font-client-impl.h b/dali/internal/text/text-abstraction/font-client-impl.h index ff86fd960..19db73dd2 100644 --- a/dali/internal/text/text-abstraction/font-client-impl.h +++ b/dali/internal/text/text-abstraction/font-client-impl.h @@ -108,6 +108,11 @@ public: // API for Dali::TextAbstraction::FontClient used. void SetDpi(unsigned int horizontalDpi, unsigned int verticalDpi); /** + * @copydoc Dali::TextAbstraction::FontClient::SetDpiFromWindowSystem() + */ + void SetDpiFromWindowSystem(); + + /** * @copydoc Dali::TextAbstraction::FontClient::GetDpi() */ void GetDpi(unsigned int& horizontalDpi, unsigned int& verticalDpi); @@ -305,6 +310,11 @@ public: // API for Dali::TextAbstraction::FontClient used. */ bool AddCustomFontDirectory(const FontPath& path); + /** + * @copydoc Dali::TextAbstraction::FontClient::ApplyCustomFontDirectories() + */ + void ApplyCustomFontDirectories(); + public: // API for Dali::TextAbstraction::Internal::FontClient used. /** * @brief Retrieves the pointer to the FreeType Font Face for the given @p fontId. diff --git a/dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.cpp b/dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.cpp index 2c962a610..cae1eb4b8 100644 --- a/dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.cpp +++ b/dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.cpp @@ -102,6 +102,7 @@ const float FROM_266 = 1.0f / 64.0f; const float POINTS_PER_INCH = 72.f; const uint32_t ELLIPSIS_CHARACTER = 0x2026; +const uint32_t CUSTOM_FONTS_MAX_COUNT = 10u; } // namespace @@ -239,7 +240,9 @@ FontClient::Plugin::Plugin(unsigned int horizontalDpi, mIsAtlasLimitationEnabled(TextAbstraction::FontClient::DEFAULT_ATLAS_LIMITATION_ENABLED), mCurrentMaximumBlockSizeFitInAtlas(TextAbstraction::FontClient::MAX_SIZE_FIT_IN_ATLAS), mVectorFontCache(nullptr), - mCacheHandler(new CacheHandler()) + mCacheHandler(new CacheHandler()), + mCustomFonts(), + mIsCustomFontsApplied(false) { int error = FT_Init_FreeType(&mFreeTypeLibrary); if(FT_Err_Ok != error) @@ -1066,10 +1069,28 @@ FontDescription::Type FontClient::Plugin::GetFontType(FontId fontId) const bool FontClient::Plugin::AddCustomFontDirectory(const FontPath& path) { + if(!mIsCustomFontsApplied) + { + if(mCustomFonts.size() > CUSTOM_FONTS_MAX_COUNT) + { + mCustomFonts.clear(); + } + mCustomFonts.push_back(path); + } // nullptr as first parameter means the current configuration is used. return FcConfigAppFontAddDir(nullptr, reinterpret_cast<const FcChar8*>(path.c_str())); } +void FontClient::Plugin::ApplyCustomFontDirectories() +{ + for(const auto& path : mCustomFonts) + { + FcConfigAppFontAddDir(nullptr, reinterpret_cast<const FcChar8*>(path.c_str())); + } + mCustomFonts.clear(); + mIsCustomFontsApplied = true; +} + HarfBuzzFontHandle FontClient::Plugin::GetHarfBuzzFont(FontId fontId) const { FontCacheItemInterface* fontCacheItem = const_cast<FontCacheItemInterface*>(GetCachedFontItem(fontId)); diff --git a/dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.h b/dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.h index ef4738738..5cdb9723c 100644 --- a/dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.h +++ b/dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.h @@ -307,6 +307,11 @@ public: // Dali::TextAbstraction::FontClient */ bool AddCustomFontDirectory(const FontPath& path); + /** + * @copydoc Dali::TextAbstraction::FontClient::ApplyCustomFontDirectories() + */ + void ApplyCustomFontDirectories(); + public: // Dali::TextAbstraction::Internal::FontClient /** * @copydoc Dali::TextAbstraction::Internal::FontClient::GetFreetypeFace() @@ -412,6 +417,9 @@ private: struct CacheHandler; CacheHandler* mCacheHandler; ///< Seperate cache for font data. + + FontPathList mCustomFonts; + bool mIsCustomFontsApplied : 1; }; } // namespace Internal diff --git a/dali/internal/text/text-abstraction/shaping-impl.cpp b/dali/internal/text/text-abstraction/shaping-impl.cpp index 7ce76bce7..36bc4998c 100644 --- a/dali/internal/text/text-abstraction/shaping-impl.cpp +++ b/dali/internal/text/text-abstraction/shaping-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -19,7 +19,6 @@ #include <dali/internal/text/text-abstraction/shaping-impl.h> // INTERNAL INCLUDES -#include <dali/devel-api/text-abstraction/font-client.h> #include <dali/devel-api/text-abstraction/glyph-info.h> #include <dali/integration-api/debug.h> #include "font-client-impl.h" @@ -131,10 +130,11 @@ struct Shaping::Plugin { } - Length Shape(const Character* const text, - Length numberOfCharacters, - FontId fontId, - Script script) + Length Shape(TextAbstraction::FontClient& fontClient, + const Character* const text, + Length numberOfCharacters, + FontId fontId, + Script script) { // Clear previoursly shaped texts. mIndices.Clear(); @@ -143,7 +143,6 @@ struct Shaping::Plugin mOffset.Clear(); mFontId = fontId; - TextAbstraction::FontClient fontClient = TextAbstraction::FontClient::Get(); TextAbstraction::Internal::FontClient& fontClientImpl = TextAbstraction::GetImplementation(fontClient); const FontDescription::Type type = fontClientImpl.GetFontType(fontId); @@ -369,14 +368,16 @@ TextAbstraction::Shaping Shaping::Get() return shapingHandle; } -Length Shaping::Shape(const Character* const text, - Length numberOfCharacters, - FontId fontId, - Script script) +Length Shaping::Shape(TextAbstraction::FontClient& fontClient, + const Character* const text, + Length numberOfCharacters, + FontId fontId, + Script script) { CreatePlugin(); - return mPlugin->Shape(text, + return mPlugin->Shape(fontClient, + text, numberOfCharacters, fontId, script); diff --git a/dali/internal/text/text-abstraction/shaping-impl.h b/dali/internal/text/text-abstraction/shaping-impl.h index 4ba0448df..7a53b3c58 100644 --- a/dali/internal/text/text-abstraction/shaping-impl.h +++ b/dali/internal/text/text-abstraction/shaping-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_TEXT_ABSTRACTION_SHAPING_IMPL_H /* - * Copyright (c) 2021 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. @@ -55,10 +55,11 @@ public: /** * @copydoc Dali::Shaping::Shape() */ - Length Shape(const Character* const text, - Length numberOfCharacters, - FontId fontId, - Script script); + Length Shape(TextAbstraction::FontClient& fontClient, + const Character* const text, + Length numberOfCharacters, + FontId fontId, + Script script); /** * @copydoc Dali::Shaping::GetGlyphs() diff --git a/dali/internal/video/common/video-player-impl.cpp b/dali/internal/video/common/video-player-impl.cpp index 0e2afc478..4166c174e 100644 --- a/dali/internal/video/common/video-player-impl.cpp +++ b/dali/internal/video/common/video-player-impl.cpp @@ -393,6 +393,22 @@ VideoPlayerPlugin* VideoPlayer::GetVideoPlayerPlugin() return mPlugin; } +void VideoPlayer::SceneConnection() +{ + if(mPlugin != nullptr) + { + mPlugin->SceneConnection(); + } +} + +void VideoPlayer::SceneDisconnection() +{ + if(mPlugin != nullptr) + { + mPlugin->SceneDisconnection(); + } +} + } // namespace Adaptor } // namespace Internal } // namespace Dali diff --git a/dali/internal/video/common/video-player-impl.h b/dali/internal/video/common/video-player-impl.h index c5da3e3b8..eeee4e929 100644 --- a/dali/internal/video/common/video-player-impl.h +++ b/dali/internal/video/common/video-player-impl.h @@ -224,6 +224,16 @@ public: */ VideoPlayerPlugin* GetVideoPlayerPlugin(); + /** + * @copydoc Dali::VideoPlayer::SceneConnection() + */ + void SceneConnection(); + + /** + * @copydoc Dali::VideoPlayer::SceneDisconnection() + */ + void SceneDisconnection(); + private: /** * @brief Constructor. diff --git a/dali/internal/window-system/common/window-impl.cpp b/dali/internal/window-system/common/window-impl.cpp index 867abc6d0..59e4504d9 100644 --- a/dali/internal/window-system/common/window-impl.cpp +++ b/dali/internal/window-system/common/window-impl.cpp @@ -587,6 +587,12 @@ void Window::Show() mSurface->SetFullSwapNextFrame(); + // Need to update/render once if surface set full swaped after adaptor call ProcessCoreEvents(). + if(DALI_LIKELY(mAdaptor)) + { + mAdaptor->RequestUpdateOnce(); + } + DALI_LOG_RELEASE_INFO("Window (%p), WinId (%d), Show(): iconified = %d, visible = %d\n", this, mNativeWindowId, mIconified, mVisible); } @@ -772,6 +778,12 @@ void Window::SetSize(Dali::Window::WindowSize size) } mSurface->SetFullSwapNextFrame(); + + // Need to update/render once if surface set full swaped after adaptor call ProcessCoreEvents(). + if(DALI_LIKELY(mAdaptor)) + { + mAdaptor->RequestUpdateOnce(); + } } Dali::Window::WindowSize Window::GetSize() const @@ -877,6 +889,12 @@ void Window::SetPositionSize(PositionSize positionSize) } mSurface->SetFullSwapNextFrame(); + + // Need to update/render once if surface set full swaped after adaptor call ProcessCoreEvents(). + if(DALI_LIKELY(mAdaptor)) + { + mAdaptor->RequestUpdateOnce(); + } } void Window::SetLayout(unsigned int numCols, unsigned int numRows, unsigned int column, unsigned int row, unsigned int colSpan, unsigned int rowSpan) @@ -994,6 +1012,12 @@ void Window::OnIconifyChanged(bool iconified) } mSurface->SetFullSwapNextFrame(); + + // Need to update/render once if surface set full swaped after adaptor call ProcessCoreEvents(). + if(DALI_LIKELY(mAdaptor)) + { + mAdaptor->RequestUpdateOnce(); + } } void Window::OnMaximizeChanged(bool maximized) @@ -1126,6 +1150,12 @@ void Window::OnUpdatePositionSize(Dali::PositionSize& positionSize) } mSurface->SetFullSwapNextFrame(); + + // Need to update/render once if surface set full swaped after adaptor call ProcessCoreEvents(). + if(DALI_LIKELY(mAdaptor)) + { + mAdaptor->RequestUpdateOnce(); + } } void Window::OnTouchPoint(Dali::Integration::Point& point, int timeStamp) @@ -1223,6 +1253,12 @@ void Window::OnResume() } mSurface->SetFullSwapNextFrame(); + + // Need to update/render once if surface set full swaped after adaptor call ProcessCoreEvents(). + if(DALI_LIKELY(mAdaptor)) + { + mAdaptor->RequestUpdateOnce(); + } } void Window::OnAuxiliaryMessage(const std::string& key, const std::string& value, const Property::Array& options) diff --git a/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp b/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp index 13edf4d00..ad8b75ca7 100644 --- a/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp +++ b/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.cpp @@ -92,6 +92,11 @@ NativeRenderSurfaceEcoreWl::~NativeRenderSurfaceEcoreWl() DestroySurface(); } + if(mEGLContext) + { + DestroyContext(); + } + // release the surface if we own one if(mOwnSurface) { @@ -172,11 +177,12 @@ void NativeRenderSurfaceEcoreWl::InitializeGraphics() if(mEGLContext == NULL) { - // Create the OpenGL context for this window - Internal::Adaptor::EglImplementation& eglImpl = static_cast<Internal::Adaptor::EglImplementation&>(*mEGL); - eglImpl.CreateWindowContext(mEGLContext); + CreateContext(); + } // Create the OpenGL surface + if(mEGLSurface == NULL) + { CreateSurface(); } } @@ -189,6 +195,7 @@ void NativeRenderSurfaceEcoreWl::CreateSurface() Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); mEGLSurface = eglImpl.CreateSurfaceWindow(reinterpret_cast<EGLNativeWindowType>(mTbmQueue), mColorDepth); + DALI_LOG_RELEASE_INFO("NativeRenderSurfaceEcoreWl::CreateSurface mTbmQueue(%p), mOwnSurface(%d), create surface: %p\n", mTbmQueue, mOwnSurface, mEGLSurface); } void NativeRenderSurfaceEcoreWl::DestroySurface() @@ -198,9 +205,32 @@ void NativeRenderSurfaceEcoreWl::DestroySurface() auto eglGraphics = static_cast<Internal::Adaptor::EglGraphics*>(mGraphics); Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); + DALI_LOG_RELEASE_INFO("NativeRenderSurfaceEcoreWl::DestroySurface mTbmQueue(%p), mOwnSurface(%d), surface: %p\n", mTbmQueue, mOwnSurface, mEGLSurface); eglImpl.DestroySurface(mEGLSurface); } +void NativeRenderSurfaceEcoreWl::CreateContext() +{ + DALI_LOG_TRACE_METHOD(gNativeSurfaceLogFilter); + + auto eglGraphics = static_cast<Internal::Adaptor::EglGraphics*>(mGraphics); + Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); + + eglImpl.CreateWindowContext(mEGLContext); + DALI_LOG_RELEASE_INFO("NativeRenderSurfaceEcoreWl::CreateContext mTbmQueue(%p), mOwnSurface(%d), create context: %p\n", mTbmQueue, mOwnSurface, mEGLContext); +} + +void NativeRenderSurfaceEcoreWl::DestroyContext() +{ + DALI_LOG_TRACE_METHOD(gNativeSurfaceLogFilter); + + auto eglGraphics = static_cast<Internal::Adaptor::EglGraphics*>(mGraphics); + Internal::Adaptor::EglImplementation& eglImpl = eglGraphics->GetEglImplementation(); + + DALI_LOG_RELEASE_INFO("NativeRenderSurfaceEcoreWl::DestroyContext mTbmQueue(%p), mOwnSurface(%d), destroy context: %p\n", mTbmQueue, mOwnSurface, mEGLContext); + eglImpl.DestroyContext(mEGLContext); +} + bool NativeRenderSurfaceEcoreWl::ReplaceGraphicsSurface() { DALI_LOG_TRACE_METHOD(gNativeSurfaceLogFilter); diff --git a/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.h b/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.h index 290fc341f..f4baa69b4 100644 --- a/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.h +++ b/dali/internal/window-system/tizen-wayland/native-render-surface-ecore-wl.h @@ -178,6 +178,16 @@ private: */ void CreateNativeRenderable() override; + /** + * Creates the context + */ + void CreateContext(); + + /** + * Destroys the context + */ + void DestroyContext(); + private: // Data SurfaceSize mSurfaceSize; TriggerEventInterface* mRenderNotification; diff --git a/dali/public-api/dali-adaptor-version.cpp b/dali/public-api/dali-adaptor-version.cpp index 2e60cabb4..12344856b 100644 --- a/dali/public-api/dali-adaptor-version.cpp +++ b/dali/public-api/dali-adaptor-version.cpp @@ -27,7 +27,7 @@ namespace Dali { const unsigned int ADAPTOR_MAJOR_VERSION = 2; const unsigned int ADAPTOR_MINOR_VERSION = 3; -const unsigned int ADAPTOR_MICRO_VERSION = 36; +const unsigned int ADAPTOR_MICRO_VERSION = 37; const char* const ADAPTOR_BUILD_DATE = __DATE__ " " __TIME__; #ifdef DEBUG_ENABLED |