virtual void SetApplicationName(std::string name) = 0;
/**
+ * @brief Sets the name of the GUI toolkit that AT-SPI clients can query.
+ *
+ * The default name is "dali".
+ *
+ * @param toolkitName The toolkit name
+ */
+ virtual void SetToolkitName(std::string_view toolkitName) = 0;
+
+ /**
* @brief Gets object being root of accessibility tree.
*
* @return handler to accessibility object
virtual bool IsEnabled() = 0;
/**
+ * @brief Calls socket.Embed(plug) via D-Bus.
+ *
+ * @param[in] plug The plug
+ * @param[in] socket The socket
+ *
+ * @return Address returned by the D-Bus call.
+ *
+ * @note Remote object pointed to by 'socket' must implement 'org.a11y.atspi.Socket'.
+ * @see UnembedSocket()
+ */
+ virtual Address EmbedSocket(const Address& plug, const Address& socket) = 0;
+
+ /**
+ * @brief Calls socket.Embedded(plug) via D-Bus.
+ *
+ * The "Embedded" D-Bus method is an ATK extension.
+ * See 'impl_Embedded' in AT_SPI2_ATK/atk-adaptor/adaptors/socket-adaptor.c for more information.
+ *
+ * @param[in] plug The plug
+ * @param[in] socket The socket
+ */
+ virtual void EmbedAtkSocket(const Address& plug, const Address& socket) = 0;
+
+ /**
+ * @brief Calls socket.Unmbed(plug) via D-Bus.
+ *
+ * @param[in] plug The plug
+ * @param[in] socket The socket
+ *
+ * @note Remote object pointed to by 'socket' must implement 'org.a11y.atspi.Socket'.
+ * @see EmbedSocket()
+ */
+ virtual void UnembedSocket(const Address& plug, const Address& socket) = 0;
+
+ /**
* @brief Returns instance of bridge singleton object.
*
* @return The current bridge object
{\r
namespace Accessibility\r
{\r
+class Accessible;\r
+\r
/**\r
* @brief Enumeration describing type of object move relative to the screen. Only outgoing moves are signalled to AT-clients.\r
*/\r
\r
/**\r
* @brief Class representing accessibility relations\r
+ *\r
* Class connecting one source object with multiple target objects with usage\r
* of specific relation type.\r
- * @note std::string representing source and targets are string values of Accessibility::Address\r
- * @see Dali::Accessibility::Accessible::Address\r
+ *\r
+ * A remote target object (i.e. one belonging to a different process) can be\r
+ * represented in terms of a ProxyAccessible.\r
+ *\r
+ * @see Dali::Accessibility::Accessible::Accessible\r
* @see Dali::Accessibility::Accessible::RelationType\r
*/\r
struct DALI_ADAPTOR_API Relation\r
{\r
- Relation(RelationType relationType, std::vector<Address> targets)\r
- : relationType(relationType),\r
- targets(targets)\r
+ Relation(RelationType relationType, const std::vector<Accessible*>& targets)\r
+ : mRelationType(relationType),\r
+ mTargets(targets)\r
{\r
}\r
\r
- RelationType relationType;\r
- std::vector<Address> targets;\r
+ RelationType mRelationType;\r
+ std::vector<Accessible*> mTargets;\r
};\r
\r
} // namespace Accessibility\r
return GetImplementation(*this).Load(data, dpi);
}
+bool VectorImageRenderer::IsLoaded() const
+{
+ return GetImplementation(*this).IsLoaded();
+}
+
Dali::Devel::PixelBuffer VectorImageRenderer::Rasterize(uint32_t width, uint32_t height)
{
return GetImplementation(*this).Rasterize(width, height);
bool Load(const Vector<uint8_t>& data, float dpi);
/**
+ * @brief Query whether the vector image is loaded.
+ *
+ * @return True if the image is loaded, false other wise.
+ */
+ bool IsLoaded() const;
+
+ /**
* @brief Rasterizes the content to the pixel buffer synchronously.
*
* @param[in] width The pixel buffer width
for(const auto& it : relations)
{
- if(it.relationType == RelationType::CONTROLLED_BY)
+ if(it.mRelationType == RelationType::CONTROLLED_BY)
{
return false;
}
for(auto& relation : obj->GetRelationSet())
{
- if(relation.relationType == relationType)
+ if(relation.mRelationType == relationType)
{
- for(auto& address : relation.targets)
+ for(auto& target : relation.mTargets)
{
- auto component = dynamic_cast<Component*>(Find(address));
+ auto component = dynamic_cast<Component*>(target);
if(component)
{
return component;
auto relation = std::find_if(relations.begin(),
relations.end(),
[relationType](const Dali::Accessibility::Relation& relation) -> bool {
- return relation.relationType == relationType;
+ return relation.mRelationType == relationType;
});
- return relations.end() != relation && !relation->targets.empty() ? Find(relation->targets.back()) : nullptr;
+ return relations.end() != relation && !relation->mTargets.empty() ? relation->mTargets.back() : nullptr;
};
auto labellingObject = findObjectByRelationType(RelationType::LABELLED_BY);
for(auto& it : relations)
{
- ret.emplace_back(Relation{static_cast<uint32_t>(it.relationType), it.targets});
+ ret.emplace_back(Relation{static_cast<uint32_t>(it.mRelationType), it.mTargets});
}
return ret;
Dali::Accessibility::Accessible* // describedByObject
>;
- using Relation = std::tuple<uint32_t, std::vector<Dali::Accessibility::Address>>;
+ using Relation = std::tuple<uint32_t, std::vector<Dali::Accessibility::Accessible*>>;
/**
* @copydoc Dali::Accessibility::Accessible::GetChildCount()
Dali::Accessibility::ProxyAccessible mParent;
std::vector<Dali::Accessibility::Accessible*> mChildren;
std::string mName;
+ std::string mToolkitName{"dali"};
std::string GetName() const override
{
std::string GetToolkitName() const override
{
- return {"dali"};
+ return mToolkitName;
}
std::string GetVersion() const override
mApplication.mName = std::move(name);
}
+ /**
+ * @copydoc Dali::Accessibility::Bridge::SetToolkitName()
+ */
+ void SetToolkitName(std::string_view toolkitName) override
+ {
+ mApplication.mToolkitName = std::string{toolkitName};
+ }
+
protected:
mutable ApplicationAccessible mApplication;
std::vector<Dali::Accessibility::Accessible*> mDefaultLabels;
mData->mHighlightActor = {};
mDisabledSignal.Emit();
+ UnembedSocket(mApplication.GetAddress(), {AtspiDbusNameRegistry, "root"});
}
+
mHighlightedActor = {};
mHighlightClearAction = {};
BridgeAccessible::ForceDown();
}
});
- auto proxy = DBus::DBusClient{AtspiDbusNameRegistry, AtspiDbusPathRoot, Accessible::GetInterfaceName(AtspiInterface::SOCKET), mConnectionPtr};
- Address root{"", "root"};
- auto res = proxy.method<Address(Address)>("Embed").call(root);
- if(!res)
- {
- LOG() << "Call to Embed failed: " << res.getError().message;
- }
- assert(res);
-
- mApplication.mParent.SetAddress(std::move(std::get<0>(res)));
-
+ auto parentAddress = EmbedSocket(mApplication.GetAddress(), {AtspiDbusNameRegistry, "root"});
+ mApplication.mParent.SetAddress(std::move(parentAddress));
mEnabledSignal.Emit();
return ForceUpResult::JUST_STARTED;
{
return mIsEnabled;
}
+
+ Address EmbedSocket(const Address& plug, const Address& socket) override
+ {
+ auto client = CreateSocketClient(socket);
+ auto reply = client.method<Address(Address)>("Embed").call(plug);
+
+ if(!reply)
+ {
+ DALI_LOG_ERROR("Failed to embed socket %s: %s", socket.ToString().c_str(), reply.getError().message.c_str());
+ return {};
+ }
+
+ return std::get<0>(reply.getValues());
+ }
+
+ void EmbedAtkSocket(const Address& plug, const Address& socket) override
+ {
+ auto client = CreateSocketClient(socket);
+
+ client.method<void(std::string)>("Embedded").call(ATSPI_PREFIX_PATH + plug.GetPath());
+ }
+
+ void UnembedSocket(const Address& plug, const Address& socket) override
+ {
+ auto client = CreateSocketClient(socket);
+
+ client.method<void(Address)>("Unembed").call(plug);
+ }
+
+private:
+ DBus::DBusClient CreateSocketClient(const Address& socket)
+ {
+ return {socket.GetBus(), ATSPI_PREFIX_PATH + socket.GetPath(), Accessible::GetInterfaceName(AtspiInterface::SOCKET), mConnectionPtr};
+ }
}; // BridgeImpl
namespace // unnamed namespace
{
}
+ void SetToolkitName(std::string_view toolkitName) override
+ {
+ }
+
Accessibility::Accessible* GetApplication() const override
{
return nullptr;
{
return false;
}
+
+ Address EmbedSocket(const Address& plug, const Address& socket) override
+ {
+ return {};
+ }
+
+ void EmbedAtkSocket(const Address& plug, const Address& socket) override
+ {
+ }
+
+ void UnembedSocket(const Address& plug, const Address& socket) override
+ {
+ }
};
} // namespace Dali::Accessibility
#define DALI_INTERNAL_EGL_IMAGE_EXTENSIONS_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.
void InitializeEglImageKHR();
private:
+ struct Impl;
+ Impl* mImpl{nullptr};
+
EglImplementation* mEglImplementation;
bool mImageKHRInitialized; ///< Flag for whether extended KHR functions loaded
/*
- * 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 <EGL/eglext.h>
+#include <tbm_bufmgr.h>
+#include <tbm_surface.h>
+#include <tbm_surface_internal.h>
+
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
PFNEGLCREATEIMAGEKHRPROC eglCreateImageKHRProc = 0;
PFNEGLDESTROYIMAGEKHRPROC eglDestroyImageKHRProc = 0;
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOESProc = 0;
+
+const std::string EGL_TIZEN_IMAGE_NATIVE_SURFACE = "EGL_TIZEN_image_native_surface";
+const std::string EGL_EXT_IMAGE_DMA_BUF_IMPORT = "EGL_EXT_image_dma_buf_import";
+
} // unnamed namespace
namespace Dali
{
namespace Adaptor
{
+struct EglImageExtensions::Impl
+{
+ bool mIsTizenImageNativeSurfaceSupported{false};
+ bool mIsExtImageDmaBufImportSupported{false};
+};
+
EglImageExtensions::EglImageExtensions(EglImplementation* eglImpl)
-: mEglImplementation(eglImpl),
+: mImpl(new Impl()),
+ mEglImplementation(eglImpl),
mImageKHRInitialized(false),
mImageKHRInitializeFailed(false)
{
EglImageExtensions::~EglImageExtensions()
{
+ delete mImpl;
}
void* EglImageExtensions::CreateImageKHR(EGLClientBuffer clientBuffer)
return NULL;
}
+ EGLImageKHR eglImage = EGL_NO_IMAGE_KHR;
+
// Use the EGL image extension
- const EGLint attribs[] =
+ if(mImpl->mIsTizenImageNativeSurfaceSupported)
+ {
+ // If EGL_TIZEN_image_native_surface is supported
+ const EGLint attribs[] = {EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE};
+
+ eglImage = eglCreateImageKHRProc(mEglImplementation->GetDisplay(),
+ EGL_NO_CONTEXT,
+ EGL_NATIVE_SURFACE_TIZEN,
+ clientBuffer,
+ attribs);
+ }
+ else if(mImpl->mIsExtImageDmaBufImportSupported)
+ {
+ // Else then use EGL_EXT_image_dma_buf_import
+ tbm_surface_info_s info;
+ tbm_surface_h tbmSurface = reinterpret_cast<tbm_surface_h>(clientBuffer);
+
+ if(tbm_surface_get_info(tbmSurface, &info) != TBM_SURFACE_ERROR_NONE)
{
- EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, EGL_NONE};
+ return NULL;
+ }
+
+ // We support only 1 plane
+ tbm_bo tbmBo = tbm_surface_internal_get_bo(tbmSurface, tbm_surface_internal_get_plane_bo_idx(tbmSurface, 0));
- EGLImageKHR eglImage = eglCreateImageKHRProc(mEglImplementation->GetDisplay(),
- EGL_NO_CONTEXT,
- EGL_NATIVE_SURFACE_TIZEN,
- clientBuffer,
- attribs);
+ // clang-format off
+ const EGLint attribs[] = {EGL_WIDTH, static_cast<EGLint>(info.width),
+ EGL_HEIGHT, static_cast<EGLint>(info.height),
+ EGL_LINUX_DRM_FOURCC_EXT, static_cast<EGLint>(info.format),
+ EGL_DMA_BUF_PLANE0_FD_EXT, static_cast<EGLint>(reinterpret_cast<size_t>(tbm_bo_get_handle(tbmBo, TBM_DEVICE_3D).ptr)),
+ EGL_DMA_BUF_PLANE0_OFFSET_EXT, static_cast<EGLint>(info.planes[0].offset),
+ EGL_DMA_BUF_PLANE0_PITCH_EXT, static_cast<EGLint>(info.planes[0].stride),
+ EGL_NONE};
+ // clang-format on
+
+ eglImage = eglCreateImageKHRProc(mEglImplementation->GetDisplay(),
+ EGL_NO_CONTEXT,
+ EGL_LINUX_DMA_BUF_EXT,
+ nullptr,
+ attribs);
+ }
+ else
+ {
+ DALI_LOG_ERROR("Not supported\n");
+ return EGL_NO_IMAGE_KHR;
+ }
if(EGL_NO_IMAGE_KHR == eglImage)
{
{
mImageKHRInitializeFailed = true;
}
+
+ std::string extensionStr = eglQueryString(mEglImplementation->GetDisplay(), EGL_EXTENSIONS);
+
+ auto found = extensionStr.find(EGL_TIZEN_IMAGE_NATIVE_SURFACE);
+ if(found != std::string::npos)
+ {
+ mImpl->mIsTizenImageNativeSurfaceSupported = true;
+ }
+
+ found = extensionStr.find(EGL_EXT_IMAGE_DMA_BUF_IMPORT);
+ if(found != std::string::npos)
+ {
+ mImpl->mIsExtImageDmaBufImportSupported = true;
+ }
}
} // namespace Adaptor
#include <dali/internal/imaging/common/image-operations.h>
#include <dali/internal/imaging/common/pixel-buffer-impl.h>
#include <dali/internal/imaging/common/pixel-manipulation.h>
-#include <dali/public-api/images/image-operations.h> // For ImageDimensions
+#include <dali/public-api/images/image-operations.h> // For ImageDimensions and MultiplyAndNormalizeColor
namespace Dali
{
for(const Channel& channel : validChannelList)
{
auto color = ReadChannel(destBuffer + destOffset, destPixelFormat, channel);
- WriteChannel(destBuffer + destOffset, destPixelFormat, channel, color * srcAlpha / 255);
+ WriteChannel(destBuffer + destOffset, destPixelFormat, channel, Platform::MultiplyAndNormalizeColor(color, srcAlpha));
}
}
else
for(unsigned int col = 0; col < buffer.GetWidth(); ++col)
{
- unsigned char srcAlpha = srcBuffer[srcOffset + srcAlphaByteOffset] & srcAlphaMask;
- unsigned char destAlpha = destBuffer[destOffset + destAlphaByteOffset] & destAlphaMask;
+ uint8_t srcAlpha = srcBuffer[srcOffset + srcAlphaByteOffset] & srcAlphaMask;
+ uint8_t destAlpha = destBuffer[destOffset + destAlphaByteOffset] & destAlphaMask;
- destAlpha = (static_cast<std::uint16_t>(destAlpha) * static_cast<std::uint16_t>(srcAlpha)) / 255;
+ destAlpha = Platform::MultiplyAndNormalizeColor(srcAlpha, destAlpha);
destBuffer[destOffset + destAlphaByteOffset] &= ~destAlphaMask;
destBuffer[destOffset + destAlphaByteOffset] |= (destAlpha & destAlphaMask);
if(hasAlpha)
{
destAlpha = ConvertAlphaChannelToA8(oldBuffer, srcColorOffset, srcColorPixelFormat);
- destAlpha = (static_cast<std::uint16_t>(destAlpha) * static_cast<std::uint16_t>(srcAlpha)) / 255;
+ destAlpha = Platform::MultiplyAndNormalizeColor(srcAlpha, destAlpha);
}
else
{
return rounded;
}
+/**
+ * @brief Fast multiply & divide by 255. It wiil be useful when we applying alpha value in color
+ *
+ * @param x The value between [0..255]
+ * @param y The value between [0..255]
+ * @return (x*y)/255
+ */
+inline uint8_t MultiplyAndNormalizeColor(const uint8_t& x, const uint8_t& y) noexcept
+{
+ const uint32_t xy = static_cast<const uint32_t>(x) * y;
+ return ((xy << 15) + (xy << 7) + xy) >> 23;
+}
+
/**@}*/
} /* namespace Platform */
if(encoded_img)
{
const Vector<unsigned char>::SizeType bufferSize = encoded_img->Count();
- encoded_img->Resize(bufferSize + length); //< Can throw OOM.
+ encoded_img->ResizeUninitialized(bufferSize + length); //< Can throw OOM.
unsigned char* const bufferBack = encoded_img->Begin() + bufferSize;
memcpy(bufferBack, data, length);
}
if(webPLoading)
{
Dali::Devel::PixelBuffer pixelBuffer = webPLoading.LoadFrame(FIRST_FRAME_INDEX);
- if(pixelBuffer && webPLoading.HasLoadingSucceeded())
+ if(pixelBuffer)
{
bitmap = pixelBuffer;
return true;
for(const Channel& channel : validChannelList)
{
auto color = ReadChannel(&pixel[x], mPixelFormat, channel);
- WriteChannel(&pixel[x], mPixelFormat, channel, color * alpha / 255);
+ WriteChannel(&pixel[x], mPixelFormat, channel, Platform::MultiplyAndNormalizeColor(color, alpha));
}
}
else
free((void*)mBuffer);
mBuffer = nullptr;
}
+
+ mLoadSucceeded = false;
}
// Moveable but not copyable
mSwCanvas->mempool(tvg::SwCanvas::MempoolPolicy::Individual);
mSwCanvas->reserve(1); //has one picture
#else
- mRasterizer = nsvgCreateRasterizer();
+ mRasterizer = nsvgCreateRasterizer();
#endif
}
return false;
}
}
+ else
+ {
+ return true;
+ }
tvg::Result ret = mPicture->load(reinterpret_cast<char*>(data.Begin()), data.Size(), true);
return true;
#else
+ if(mParsedImage)
+ {
+ return true;
+ }
+
mParsedImage = nsvgParse(reinterpret_cast<char*>(data.Begin()), UNITS, dpi);
if(!mParsedImage || !mParsedImage->shapes)
{
#endif
}
+bool VectorImageRenderer::IsLoaded() const
+{
+#ifdef THORVG_SUPPORT
+ return mPicture ? true : false;
+#else
+ return mParsedImage ? true : false;
+#endif
+}
+
Dali::Devel::PixelBuffer VectorImageRenderer::Rasterize(uint32_t width, uint32_t height)
{
if(width == 0)
bool Load(const Vector<uint8_t>& data, float dpi);
/**
+ * @copydoc Dali::VectorImageRenderer::IsLoaded()
+ */
+ bool IsLoaded() const;
+
+ /**
* @copydoc Dali::VectorImageRenderer::Rasterize()
*/
Dali::Devel::PixelBuffer Rasterize(uint32_t width, uint32_t height);
mWindowPositionSize.height = newHeight;
DALI_LOG_RELEASE_INFO("Update position & resize signal by server, current angle [%d] x[%d] y[%d] w[%d] h[%d]\n", mWindowRotationAngle, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
+ ecore_wl2_window_geometry_set(mEcoreWindow, mWindowPositionSize.x, mWindowPositionSize.y, mWindowPositionSize.width, mWindowPositionSize.height);
+
Dali::PositionSize newPositionSize = RecalculatePositionSizeToCurrentOrientation(mWindowPositionSize);
DALI_LOG_RELEASE_INFO("emit signal to update window's position and size, x[%d] y[%d] w[%d] h[%d]\n", newPositionSize.x, newPositionSize.y, newPositionSize.width, newPositionSize.height);
mUpdatePositionSizeSignal.Emit(newPositionSize);
{
const unsigned int ADAPTOR_MAJOR_VERSION = 2;
const unsigned int ADAPTOR_MINOR_VERSION = 1;
-const unsigned int ADAPTOR_MICRO_VERSION = 21;
+const unsigned int ADAPTOR_MICRO_VERSION = 23;
const char* const ADAPTOR_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali2-adaptor
Summary: The DALi Tizen Adaptor
-Version: 2.1.21
+Version: 2.1.23
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT