mCallStack.PushCall("EndRenderPass", namedParams.str(), namedParams);
}
- void ReadPixels(uint8_t* buffer) override
- {
- }
-
void ExecuteCommandBuffers(std::vector<const CommandBuffer*>&& commandBuffers) override
{
mCommands.emplace_back();
**/
virtual void EmitMovedOutOfScreen(Accessible* obj, ScreenRelativeMoveType type) = 0;
+ /**
+ * @brief Emits "org.a11y.atspi.Socket.Available" event on AT-SPI bus.
+ *
+ * @param obj Accessible object
+ */
+ virtual void EmitSocketAvailable(Accessible* obj) = 0;
+
/**
* @brief Emits ScrollStarted event on at-spi bus.
*
void OnPostRender()
{
- try
- {
- Accessibility::Bridge::GetCurrentBridge()->EmitPostRender(shared_from_this());
- }
- catch(const std::bad_weak_ptr& e)
- {
- DALI_LOG_ERROR("bad_weak_ptr exception caught: %s", e.what());
- }
+ Accessibility::Bridge::GetCurrentBridge()->EmitPostRender(shared_from_this());
}
}; // AdaptorAccessible
// EXTERNAL INCLUDES
#include <dali/devel-api/actors/actor-devel.h>
-#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/window-devel.h>
-using namespace Dali::Accessibility;
-
-namespace
-{
-bool UpdateLastEmitted(std::map<State, int>& lastEmitted, State state, int newValue)
-{
- bool updated = false;
- const auto [iter, inserted] = lastEmitted.emplace(state, newValue);
- if(!inserted && iter->second != newValue)
- {
- iter->second = newValue;
- updated = true;
- }
-
- return inserted || updated;
-}
-
-bool IsModalRole(Role role)
-{
- return role == Role::POPUP_MENU || role == Role::PANEL || role == Role::DIALOG || role == Role::PAGE_TAB;
-}
-
-bool IsWindowRole(Role role)
-{
- return role == Role::WINDOW || role == Role::FRAME || role == Role::INPUT_METHOD_WINDOW;
-}
-
-bool ShouldEmitVisible(Accessible* accessible)
-{
- Role role = accessible->GetRole();
- return IsWindowRole(role);
-}
-
-bool ShouldEmitShowing(Accessible* accessible, bool showing)
-{
- Role role = accessible->GetRole();
- return IsWindowRole(role) || IsModalRole(role) || (showing && role == Role::NOTIFICATION) ||
- (!showing && accessible->IsHighlighted()) || accessible->GetStates()[State::MODAL];
-}
-
-} // namespace
-
namespace Dali::Accessibility
{
ActorAccessible::ActorAccessible(Actor actor)
// Erase-remove idiom
// TODO (C++20): Replace with std::erase_if
- auto it = std::remove_if(mChildren.begin(), mChildren.end(), [shouldIncludeHidden](const Accessible* child) { return !child || (!shouldIncludeHidden && child->IsHidden()); });
+ auto it = std::remove_if(mChildren.begin(), mChildren.end(), [shouldIncludeHidden](const Accessible* child) {
+ return !child || (!shouldIncludeHidden && child->IsHidden());
+ });
mChildren.erase(it, mChildren.end());
mChildren.shrink_to_fit();
}
-void ActorAccessible::EmitActiveDescendantChanged(Accessible* child)
-{
- if(auto bridgeData = GetBridgeData())
- {
- bridgeData->mBridge->EmitActiveDescendantChanged(this, child);
- }
-}
-
-void ActorAccessible::EmitStateChanged(State state, int newValue, int reserved)
-{
- if(auto bridgeData = GetBridgeData())
- {
- bool shouldEmit{false};
-
- switch(state)
- {
- case State::SHOWING:
- {
- shouldEmit = ShouldEmitShowing(this, static_cast<bool>(newValue));
- break;
- }
- case State::VISIBLE:
- {
- shouldEmit = ShouldEmitVisible(this);
- break;
- }
- default:
- {
- shouldEmit = UpdateLastEmitted(mLastEmittedState, state, newValue);
- break;
- }
- }
-
- if(shouldEmit)
- {
- try
- {
- bridgeData->mBridge->EmitStateChanged(shared_from_this(), state, newValue, reserved);
- }
- catch(const std::bad_weak_ptr& e)
- {
- DALI_LOG_ERROR("bad_weak_ptr exception caught: %s", e.what());
- }
- }
- }
-}
-
-void ActorAccessible::EmitShowing(bool isShowing)
-{
- EmitStateChanged(State::SHOWING, isShowing ? 1 : 0);
-}
-
-void ActorAccessible::EmitVisible(bool isVisible)
-{
- EmitStateChanged(State::VISIBLE, isVisible ? 1 : 0);
-}
-
-void ActorAccessible::EmitHighlighted(bool isHighlighted)
-{
- EmitStateChanged(State::HIGHLIGHTED, isHighlighted ? 1 : 0);
-}
-
-void ActorAccessible::EmitFocused(bool isFocused)
-{
- EmitStateChanged(State::FOCUSED, isFocused ? 1 : 0);
-}
-
-void ActorAccessible::EmitTextInserted(unsigned int position, unsigned int length, const std::string& content)
-{
- if(auto bridgeData = GetBridgeData())
- {
- bridgeData->mBridge->EmitTextChanged(this, TextChangedState::INSERTED, position, length, content);
- }
-}
-void ActorAccessible::EmitTextDeleted(unsigned int position, unsigned int length, const std::string& content)
-{
- if(auto bridgeData = GetBridgeData())
- {
- bridgeData->mBridge->EmitTextChanged(this, TextChangedState::DELETED, position, length, content);
- }
-}
-void ActorAccessible::EmitTextCursorMoved(unsigned int cursorPosition)
-{
- if(auto bridgeData = GetBridgeData())
- {
- bridgeData->mBridge->EmitCursorMoved(this, cursorPosition);
- }
-}
-
-void ActorAccessible::EmitMovedOutOfScreen(ScreenRelativeMoveType type)
-{
- if(auto bridgeData = GetBridgeData())
- {
- bridgeData->mBridge->EmitMovedOutOfScreen(this, type);
- }
-}
-
-void ActorAccessible::EmitScrollStarted()
-{
- if(auto bridgeData = GetBridgeData())
- {
- bridgeData->mBridge->EmitScrollStarted(this);
- }
-}
-
-void ActorAccessible::EmitScrollFinished()
-{
- if(auto bridgeData = GetBridgeData())
- {
- bridgeData->mBridge->EmitScrollFinished(this);
- }
-}
-
-void ActorAccessible::Emit(WindowEvent event, unsigned int detail)
-{
- if(auto bridgeData = GetBridgeData())
- {
- bridgeData->mBridge->Emit(this, event, detail);
- }
-}
-void ActorAccessible::Emit(ObjectPropertyChangeEvent event)
-{
- if(auto bridgeData = GetBridgeData())
- {
- try
- {
- bridgeData->mBridge->Emit(shared_from_this(), event);
- }
- catch(const std::bad_weak_ptr& e)
- {
- DALI_LOG_ERROR("bad_weak_ptr exception caught: %s", e.what());
- }
- }
-}
-
-void ActorAccessible::EmitBoundsChanged(Rect<> rect)
-{
- if(auto bridgeData = GetBridgeData())
- {
- try
- {
- bridgeData->mBridge->EmitBoundsChanged(shared_from_this(), rect);
- }
- catch(const std::bad_weak_ptr& e)
- {
- DALI_LOG_ERROR("bad_weak_ptr exception caught: %s", e.what());
- }
- }
-}
-
-void ActorAccessible::NotifyAccessibilityStateChange(Dali::Accessibility::States states, bool isRecursive)
-{
- if(Accessibility::IsUp())
- {
- const auto newStates = GetStates();
- for(auto i = 0u; i < static_cast<unsigned int>(Dali::Accessibility::State::MAX_COUNT); i++)
- {
- const auto index = static_cast<Dali::Accessibility::State>(i);
- if(states[index])
- {
- EmitStateChanged(index, newStates[index]);
- }
- }
-
- if(isRecursive)
- {
- auto children = GetChildren();
- for(auto child : children)
- {
- if(auto accessible = dynamic_cast<ActorAccessible*>(child))
- {
- accessible->NotifyAccessibilityStateChange(states, isRecursive);
- }
- }
- }
- }
-}
-
} // namespace Dali::Accessibility
public virtual Collection,
public virtual Component,
public Dali::ConnectionTracker,
- public Dali::BaseObjectObserver,
- public std::enable_shared_from_this<ActorAccessible>
+ public Dali::BaseObjectObserver
{
public:
ActorAccessible() = delete;
*/
void OnChildrenChanged();
- /**
- * @brief Helper function for emiting active-descendant-changed event.
- *
- * @param[in] child The child of the object
- */
- void EmitActiveDescendantChanged(Accessible* child);
-
- /**
- * @brief Helper function for emiting state-changed event.
- *
- * @param[in] state The accessibility state (SHOWING, HIGHLIGHTED, etc)
- * @param[in] newValue Whether the state value is changed to new value or not.
- * @param[in] reserved Reserved. (TODO : Currently, this argument is not implemented in dali)
- *
- * @note The second argument determines which value is depending on State.
- * For instance, if the state is PRESSED, newValue means isPressed or isSelected.
- * If the state is SHOWING, newValue means isShowing.
- */
- void EmitStateChanged(State state, int newValue, int reserved = 0);
-
- /**
- * @brief Helper function for emiting bounds-changed event.
- *
- * @param rect The rectangle for changed bounds
- */
- void EmitBoundsChanged(Rect<> rect);
-
- /**
- * @brief Emits "showing" event.
- * The method informs accessibility clients about "showing" state.
- *
- * @param[in] isShowing The flag pointing if object is showing
- */
- void EmitShowing(bool isShowing);
-
- /**
- * @brief Emits "visible" event.
- * The method informs accessibility clients about "visible" state.
- *
- * @param[in] isVisible The flag pointing if object is visible
- */
- void EmitVisible(bool isVisible);
-
- /**
- * @brief Emits "highlighted" event.
- * The method informs accessibility clients about "highlighted" state.
- *
- * @param[in] isHighlighted The flag pointing if object is highlighted
- */
- void EmitHighlighted(bool isHighlighted);
-
- /**
- * @brief Emits "focused" event.
- * The method informs accessibility clients about "focused" state.
- *
- * @param[in] isFocused The flag pointing if object is focused
- */
- void EmitFocused(bool isFocused);
-
- /**
- * @brief Emits "text inserted" event.
- *
- * @param[in] position The cursor position
- * @param[in] length The text length
- * @param[in] content The inserted text
- */
- void EmitTextInserted(unsigned int position, unsigned int length, const std::string& content);
-
- /**
- * @brief Emits "text deleted" event.
- *
- * @param[in] position The cursor position
- * @param[in] length The text length
- * @param[in] content The deleted text
- */
- void EmitTextDeleted(unsigned int position, unsigned int length, const std::string& content);
-
- /**
- * @brief Emits "cursor moved" event.
- *
- * @param[in] cursorPosition The new cursor position
- */
- void EmitTextCursorMoved(unsigned int cursorPosition);
-
- /**
- * @brief Emits "MoveOuted" event.
- *
- * @param[in] type moved out of screen type
- */
- void EmitMovedOutOfScreen(ScreenRelativeMoveType type);
-
- /**
- * @brief Emits "ScrollStarted" event.
- *
- */
- void EmitScrollStarted();
-
- /**
- * @brief Emits "ScrollFinished" event.
- *
- */
- void EmitScrollFinished();
-
- /**
- * @brief Emits "highlighted" event.
- *
- * @param[in] event The enumerated window event
- * @param[in] detail The additional parameter which interpretation depends on chosen event
- */
- void Emit(WindowEvent event, unsigned int detail = 0);
-
- /**
- * @brief Emits property-changed event.
- *
- * @param[in] event Property changed event
- **/
- void Emit(ObjectPropertyChangeEvent event);
-
- /**
- * @brief Re-emits selected states of an Accessibility Object.
- *
- * @param[in] states The chosen states to re-emit
- * @param[in] isRecursive If true, all children of the Accessibility object will also re-emit the states
- */
- void NotifyAccessibilityStateChange(Dali::Accessibility::States states, bool isRecursive);
-
protected:
Dali::Actor Self() const
{
std::vector<Accessible*> mChildren;
bool mChildrenDirty;
const uint32_t mActorId;
- std::map<State, int> mLastEmittedState;
};
} // namespace Dali::Accessibility
* @brief Get PixelBuffer of captured image.
*
* @return PixelBuffer Captured result
- * @note GetCapturedBuffer is only available inside FinishedSignal, otherwise this returns empty handle.
*/
DALI_ADAPTOR_API Dali::Devel::PixelBuffer GetCapturedBuffer(Dali::Capture capture);
return Dali::Internal::Adaptor::NativeImageSource::GetImplementation(image).ReleaseBuffer(updatedArea);\r
}\r
\r
-bool SetPixels(NativeImageSource& image, uint8_t* pixbuf, const Pixel::Format& pixelFormat)\r
-{\r
- return Dali::Internal::Adaptor::NativeImageSource::GetImplementation(image).SetPixels(pixbuf, pixelFormat);\r
-}\r
-\r
void SetResourceDestructionCallback(NativeImageSource& image, EventThreadCallback* callback)\r
{\r
return Dali::Internal::Adaptor::NativeImageSource::GetImplementation(image).SetResourceDestructionCallback(callback);\r
*/\r
DALI_ADAPTOR_API bool ReleaseBuffer(NativeImageSource& image, const Rect<uint32_t>& updatedArea);\r
\r
-/**\r
- * @brief Sets PixelBuffers to NativeImageSource\r
- *\r
- * @param[in] image The instance of NativeImageSource.\r
- * @param[in] pixbuf Pixel buffer to copy.\r
- * @param[in] pixelFormat Pixel format of the pixel buffer\r
- * @return @c true If the buffer is successfully set.\r
- * @note The width and height of the input pixel buffer should be same with those of NativeImageSource.\r
- * @note Only Pixel::Format::RGB888 and Pixel::Format::RGBA8888 are available as a input pixel format.\r
- */\r
-DALI_ADAPTOR_API bool SetPixels(NativeImageSource& image, uint8_t* pixbuf, const Pixel::Format& pixelFormat);\r
-\r
/**\r
* @brief Set the Resource Destruction Callback object\r
*\r
/**
* @brief Basic interface implemented by all accessibility objects.
*/
-class DALI_ADAPTOR_API Accessible
+class DALI_ADAPTOR_API Accessible : public std::enable_shared_from_this<Accessible>
{
public:
virtual ~Accessible() noexcept;
+ /**
+ * @brief Helper function for emiting active-descendant-changed event.
+ *
+ * @param[in] child The child of the object
+ */
+ void EmitActiveDescendantChanged(Accessible* child);
+
+ /**
+ * @brief Helper function for emiting state-changed event.
+ *
+ * @param[in] state The accessibility state (SHOWING, HIGHLIGHTED, etc)
+ * @param[in] newValue Whether the state value is changed to new value or not.
+ * @param[in] reserved Reserved. (TODO : Currently, this argument is not implemented in dali)
+ *
+ * @note The second argument determines which value is depending on State.
+ * For instance, if the state is PRESSED, newValue means isPressed or isSelected.
+ * If the state is SHOWING, newValue means isShowing.
+ */
+ void EmitStateChanged(State state, int newValue, int reserved = 0);
+
+ /**
+ * @brief Helper function for emiting bounds-changed event.
+ *
+ * @param rect The rectangle for changed bounds
+ */
+ void EmitBoundsChanged(Rect<> rect);
+
+ /**
+ * @brief Emits "showing" event.
+ * The method informs accessibility clients about "showing" state.
+ *
+ * @param[in] isShowing The flag pointing if object is showing
+ */
+ void EmitShowing(bool isShowing);
+
+ /**
+ * @brief Emits "visible" event.
+ * The method informs accessibility clients about "visible" state.
+ *
+ * @param[in] isVisible The flag pointing if object is visible
+ */
+ void EmitVisible(bool isVisible);
+
+ /**
+ * @brief Emits "highlighted" event.
+ * The method informs accessibility clients about "highlighted" state.
+ *
+ * @param[in] isHighlighted The flag pointing if object is highlighted
+ */
+ void EmitHighlighted(bool isHighlighted);
+
+ /**
+ * @brief Emits "focused" event.
+ * The method informs accessibility clients about "focused" state.
+ *
+ * @param[in] isFocused The flag pointing if object is focused
+ */
+ void EmitFocused(bool isFocused);
+
+ /**
+ * @brief Emits "text inserted" event.
+ *
+ * @param[in] position The cursor position
+ * @param[in] length The text length
+ * @param[in] content The inserted text
+ */
+ void EmitTextInserted(unsigned int position, unsigned int length, const std::string& content);
+
+ /**
+ * @brief Emits "text deleted" event.
+ *
+ * @param[in] position The cursor position
+ * @param[in] length The text length
+ * @param[in] content The deleted text
+ */
+ void EmitTextDeleted(unsigned int position, unsigned int length, const std::string& content);
+
+ /**
+ * @brief Emits "cursor moved" event.
+ *
+ * @param[in] cursorPosition The new cursor position
+ */
+ void EmitTextCursorMoved(unsigned int cursorPosition);
+
+ /**
+ * @brief Emits "MoveOuted" event.
+ *
+ * @param[in] type moved out of screen type
+ */
+ void EmitMovedOutOfScreen(ScreenRelativeMoveType type);
+
+ /**
+ * @brief Emits "org.a11y.atspi.Socket.Available" signal.
+ */
+ // This belongs to Dali::Accessibility::Socket. However, all Emit*() helpers
+ // are here in Accessible, regardless of what interface they belong to (perhaps
+ // to spare a dynamic_cast if used like this: Accessible::Get()->Emit*(...)).
+ void EmitSocketAvailable();
+
+ /**
+ * @brief Emits "ScrollStarted" event.
+ *
+ */
+ void EmitScrollStarted();
+
+ /**
+ * @brief Emits "ScrollFinished" event.
+ *
+ */
+ void EmitScrollFinished();
+
+ /**
+ * @brief Emits "highlighted" event.
+ *
+ * @param[in] event The enumerated window event
+ * @param[in] detail The additional parameter which interpretation depends on chosen event
+ */
+ void Emit(WindowEvent event, unsigned int detail = 0);
+
+ /**
+ * @brief Emits property-changed event.
+ *
+ * @param[in] event Property changed event
+ **/
+ void Emit(ObjectPropertyChangeEvent event);
+
/**
* @brief Gets accessibility name.
*
*/
virtual bool DoGesture(const GestureInfo& gestureInfo) = 0;
+ /**
+ * @brief Re-emits selected states of an Accessibility Object.
+ *
+ * @param[in] states The chosen states to re-emit
+ * @param[in] isRecursive If true, all children of the Accessibility object will also re-emit the states
+ */
+ void NotifyAccessibilityStateChange(Dali::Accessibility::States states, bool isRecursive);
+
/**
* @brief Gets information about current object and all relations that connects
* it with other accessibility objects.
mutable AtspiInterfaces mInterfaces;
AtspiEvents mSuppressedEvents;
bool mIsOnRootLevel = false;
+ std::map<State, int> mLastEmittedState;
}; // Accessible class
using namespace Dali::Accessibility;
+namespace
+{
+bool UpdateLastEmitted(std::map<State, int>& lastEmitted, State state, int newValue)
+{
+ bool updated = false;
+ const auto [iter, inserted] = lastEmitted.emplace(state, newValue);
+ if(!inserted && iter->second != newValue)
+ {
+ iter->second = newValue;
+ updated = true;
+ }
+
+ return inserted || updated;
+}
+
+bool IsModalRole(Role role)
+{
+ return role == Role::POPUP_MENU || role == Role::PANEL || role == Role::DIALOG || role == Role::PAGE_TAB;
+}
+
+bool IsWindowRole(Role role)
+{
+ return role == Role::WINDOW || role == Role::FRAME || role == Role::INPUT_METHOD_WINDOW;
+}
+
+bool ShouldEmitVisible(Accessible* accessible)
+{
+ Role role = accessible->GetRole();
+ return IsWindowRole(role);
+}
+
+bool ShouldEmitShowing(Accessible* accessible, bool showing)
+{
+ Role role = accessible->GetRole();
+ return IsWindowRole(role) || IsModalRole(role) || (showing && role == Role::NOTIFICATION) ||
+ (!showing && accessible->IsHighlighted()) || accessible->GetStates()[State::MODAL];
+}
+
+} // namespace
+
Accessible::Accessible()
{
}
}
}
+void Accessible::EmitActiveDescendantChanged(Accessible* child)
+{
+ if(auto bridgeData = GetBridgeData())
+ {
+ bridgeData->mBridge->EmitActiveDescendantChanged(this, child);
+ }
+}
+
+void Accessible::EmitStateChanged(State state, int newValue, int reserved)
+{
+ if(auto bridgeData = GetBridgeData())
+ {
+ bool shouldEmit{false};
+
+ switch(state)
+ {
+ case State::SHOWING:
+ {
+ shouldEmit = ShouldEmitShowing(this, static_cast<bool>(newValue));
+ break;
+ }
+ case State::VISIBLE:
+ {
+ shouldEmit = ShouldEmitVisible(this);
+ break;
+ }
+ default:
+ {
+ shouldEmit = UpdateLastEmitted(mLastEmittedState, state, newValue);
+ break;
+ }
+ }
+
+ if(shouldEmit)
+ {
+ bridgeData->mBridge->EmitStateChanged(shared_from_this(), state, newValue, reserved);
+ }
+ }
+}
+
+void Accessible::EmitShowing(bool isShowing)
+{
+ EmitStateChanged(State::SHOWING, isShowing ? 1 : 0);
+}
+
+void Accessible::EmitVisible(bool isVisible)
+{
+ EmitStateChanged(State::VISIBLE, isVisible ? 1 : 0);
+}
+
+void Accessible::EmitHighlighted(bool isHighlighted)
+{
+ EmitStateChanged(State::HIGHLIGHTED, isHighlighted ? 1 : 0);
+}
+
+void Accessible::EmitFocused(bool isFocused)
+{
+ EmitStateChanged(State::FOCUSED, isFocused ? 1 : 0);
+}
+
+void Accessible::EmitTextInserted(unsigned int position, unsigned int length, const std::string& content)
+{
+ if(auto bridgeData = GetBridgeData())
+ {
+ bridgeData->mBridge->EmitTextChanged(this, TextChangedState::INSERTED, position, length, content);
+ }
+}
+void Accessible::EmitTextDeleted(unsigned int position, unsigned int length, const std::string& content)
+{
+ if(auto bridgeData = GetBridgeData())
+ {
+ bridgeData->mBridge->EmitTextChanged(this, TextChangedState::DELETED, position, length, content);
+ }
+}
+void Accessible::EmitTextCursorMoved(unsigned int cursorPosition)
+{
+ if(auto bridgeData = GetBridgeData())
+ {
+ bridgeData->mBridge->EmitCursorMoved(this, cursorPosition);
+ }
+}
+
+void Accessible::EmitMovedOutOfScreen(ScreenRelativeMoveType type)
+{
+ if(auto bridgeData = GetBridgeData())
+ {
+ bridgeData->mBridge->EmitMovedOutOfScreen(this, type);
+ }
+}
+
+void Accessible::EmitSocketAvailable()
+{
+ DALI_ASSERT_DEBUG(Socket::DownCast(this));
+
+ if(auto bridgeData = GetBridgeData())
+ {
+ bridgeData->mBridge->EmitSocketAvailable(this);
+ }
+}
+
+void Accessible::EmitScrollStarted()
+{
+ if(auto bridgeData = GetBridgeData())
+ {
+ bridgeData->mBridge->EmitScrollStarted(this);
+ }
+}
+
+void Accessible::EmitScrollFinished()
+{
+ if(auto bridgeData = GetBridgeData())
+ {
+ bridgeData->mBridge->EmitScrollFinished(this);
+ }
+}
+
+void Accessible::Emit(WindowEvent event, unsigned int detail)
+{
+ if(auto bridgeData = GetBridgeData())
+ {
+ bridgeData->mBridge->Emit(this, event, detail);
+ }
+}
+void Accessible::Emit(ObjectPropertyChangeEvent event)
+{
+ if(auto bridgeData = GetBridgeData())
+ {
+ bridgeData->mBridge->Emit(shared_from_this(), event);
+ }
+}
+
+void Accessible::EmitBoundsChanged(Rect<> rect)
+{
+ if(auto bridgeData = GetBridgeData())
+ {
+ bridgeData->mBridge->EmitBoundsChanged(shared_from_this(), rect);
+ }
+}
+
std::shared_ptr<Bridge::Data> Accessible::GetBridgeData() const
{
auto handle = mBridgeData.lock();
{
return false;
}
+
+void Accessible::NotifyAccessibilityStateChange(Dali::Accessibility::States states, bool isRecursive)
+{
+ if(Accessibility::IsUp())
+ {
+ const auto newStates = GetStates();
+ for(auto i = 0u; i < static_cast<unsigned int>(Dali::Accessibility::State::MAX_COUNT); i++)
+ {
+ const auto index = static_cast<Dali::Accessibility::State>(i);
+ if(states[index])
+ {
+ EmitStateChanged(index, newStates[index]);
+ }
+ }
+
+ if(isRecursive)
+ {
+ auto children = GetChildren();
+ for(auto iter : children)
+ {
+ iter->NotifyAccessibilityStateChange(states, isRecursive);
+ }
+ }
+ }
+}
#include <tuple>
// INTERNAL INCLUDES
-#include <dali/devel-api/adaptor-framework/actor-accessible.h>
#include <dali/devel-api/adaptor-framework/proxy-accessible.h>
#include <dali/devel-api/adaptor-framework/window-devel.h>
#include <dali/devel-api/atspi-interfaces/accessible.h>
* @return Null if mChildren is empty, otherwise the Accessible object
* @note Currently, the default window would be returned when mChildren is not empty.
*/
- Dali::Accessibility::ActorAccessible* GetWindowAccessible(Dali::Window window)
+ Dali::Accessibility::Accessible* GetWindowAccessible(Dali::Window window)
{
if(mChildren.empty())
{
{
if(rootLayer == mChildren[i]->GetInternalActor())
{
- return dynamic_cast<Dali::Accessibility::ActorAccessible*>(mChildren[i]);
+ return mChildren[i];
}
}
// If can't find its children, return the default window.
- return dynamic_cast<Dali::Accessibility::ActorAccessible*>(mChildren[0]);
+ return mChildren[0];
}
bool DoGesture(const Dali::Accessibility::GestureInfo& gestureInfo) override
{"", "root"});
}
+void BridgeObject::EmitSocketAvailable(Accessible* obj)
+{
+ if(!IsUp() || obj->IsHidden()) //TODO Suppress SocketAvailable event
+ {
+ return;
+ }
+
+ mDbusServer.emit2<Address, Address>(
+ GetAccessiblePath(obj),
+ Accessible::GetInterfaceName(AtspiInterface::SOCKET),
+ "Available",
+ obj->GetAddress(),
+ {"", "root"});
+}
+
void BridgeObject::EmitScrollStarted(Accessible* obj)
{
if(!IsUp() || obj->IsHidden() || obj->GetSuppressedEvents()[AtspiEvent::SCROLL_STARTED])
*/
void EmitMovedOutOfScreen(Dali::Accessibility::Accessible* obj, Dali::Accessibility::ScreenRelativeMoveType type) override;
+ /**
+ * @copydoc Dali::Accessibility::Bridge::EmitSocketAvailable()
+ */
+ void EmitSocketAvailable(Dali::Accessibility::Accessible* obj) override;
+
/**
* @copydoc Dali::Accessibility::Bridge::EmitScrollStarted()
*/
/*
- * Copyright (c) 2024 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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 std::string{widgetInstanceId};
}
+void Accessibility::Accessible::EmitStateChanged(Accessibility::State state, int newValue, int reserved)
+{
+}
+
+void Accessibility::Accessible::Emit(Accessibility::ObjectPropertyChangeEvent event)
+{
+}
+
+void Accessibility::Accessible::EmitHighlighted(bool set)
+{
+}
+
+void Accessibility::Accessible::EmitBoundsChanged(Rect<> rect)
+{
+}
+
+void Accessibility::Accessible::EmitShowing(bool showing)
+{
+}
+
+void Accessibility::Accessible::EmitFocused(bool set)
+{
+}
+
+void Accessibility::Accessible::EmitVisible(bool visible)
+{
+}
+
+void Accessibility::Accessible::EmitTextInserted(unsigned int position, unsigned int length, const std::string& content)
+{
+}
+
+void Accessibility::Accessible::EmitTextDeleted(unsigned int position, unsigned int length, const std::string& content)
+{
+}
+
+void Accessibility::Accessible::EmitTextCursorMoved(unsigned int cursorPosition)
+{
+}
+
+void Accessibility::Accessible::EmitActiveDescendantChanged(Accessibility::Accessible* child)
+{
+}
+
+void Accessibility::Accessible::EmitMovedOutOfScreen(Accessibility::ScreenRelativeMoveType type)
+{
+}
+
+void Accessibility::Accessible::EmitSocketAvailable()
+{
+}
+
+void Accessibility::Accessible::EmitScrollStarted()
+{
+}
+
+void Accessibility::Accessible::EmitScrollFinished()
+{
+}
+
+void Accessibility::Accessible::NotifyAccessibilityStateChange(Accessibility::States states, bool isRecursive)
+{
+}
+
} // namespace Dali
{
}
+ void EmitSocketAvailable(Accessibility::Accessible* obj) override
+ {
+ }
+
void EmitScrollStarted(Accessibility::Accessible* obj) override
{
}
fprintf(output, "{\"Cmd\":\"END_RENDER_PASS\"}\n");
break;
}
- case GLES::CommandType::READ_PIXELS:
- {
- fprintf(output, "{\"Cmd\":\"READ_PIXELS\"}\n");
- break;
- }
case GLES::CommandType::PRESENT_RENDER_TARGET:
{
fprintf(output, "{\"Cmd\":\"PRESENT_RENDER_TARGET\"}\n");
}
break;
}
- case GLES::CommandType::READ_PIXELS:
- {
- mCurrentContext->ReadPixels(cmd.readPixelsBuffer.buffer);
- break;
- }
case GLES::CommandType::PRESENT_RENDER_TARGET:
{
ResolvePresentRenderTarget(cmd.presentRenderTarget.targetToPresent);
}
}
-void Context::ReadPixels(uint8_t* buffer)
-{
- if(mImpl->mCurrentRenderTarget)
- {
- GLES::Framebuffer* framebuffer = mImpl->mCurrentRenderTarget->GetFramebuffer();
- auto* gl = mImpl->GetGL();
- if(framebuffer && gl)
- {
- gl->Finish(); // To guarantee ReadPixels.
- gl->ReadPixels(0, 0, framebuffer->GetCreateInfo().size.width, framebuffer->GetCreateInfo().size.height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);
- }
- }
-}
-
-
void Context::ClearState()
{
mImpl->mCurrentTextureBindings.clear();
*/
void EndRenderPass(TextureDependencyChecker& checker);
- /**
- * @brief Request to read pixels
- * @param[out] buffer to load pixel data.
- */
- void ReadPixels(uint8_t* buffer);
-
/**
* @brief Returns the cache of GL state in the context
* @return the reference of GL state cache (which can be modified)
command->endRenderPass.syncObject = static_cast<GLES::SyncObject*>(syncObject);
}
-void CommandBuffer::ReadPixels(uint8_t* buffer)
-{
- auto command = mCommandPool->AllocateCommand(CommandType::READ_PIXELS);
- command->readPixelsBuffer.buffer = buffer;
-}
-
void CommandBuffer::ExecuteCommandBuffers(std::vector<const Graphics::CommandBuffer*>&& commandBuffers)
{
auto command = mCommandPool->AllocateCommand(CommandType::EXECUTE_COMMAND_BUFFERS);
SET_VIEWPORT,
BEGIN_RENDERPASS,
END_RENDERPASS,
- READ_PIXELS,
EXECUTE_COMMAND_BUFFERS,
PRESENT_RENDER_TARGET,
SET_COLOR_MASK,
Graphics::SyncObject* syncObject;
} endRenderPass;
- struct
- {
- uint8_t* buffer;
- } readPixelsBuffer;
-
struct
{
IndirectPtr<const GLES::CommandBuffer*> buffers;
*/
void EndRenderPass(Graphics::SyncObject* syncObject) override;
- /**
- * @copydoc Dali::Graphics::CommandBuffer::ReadPixels
- */
- void ReadPixels(uint8_t* buffer) override;
-
/**
* @copydoc Dali::Graphics::CommandBuffer::ExecuteCommandBuffers
*/
{
auto shader = gl->CreateShader(pipelineStage);
const auto src = !sourcePreprocessed.empty() ? reinterpret_cast<const char*>(sourcePreprocessed.data()) : reinterpret_cast<const char*>(createInfo.sourceData);
-
- // null-terminated char already included. So we should remove last character (null terminator) from size.
- GLint size = (!sourcePreprocessed.empty() ? GLint(sourcePreprocessed.size()) : createInfo.sourceSize) - 1u;
-
+ GLint size = !sourcePreprocessed.empty() ? GLint(sourcePreprocessed.size()) : createInfo.sourceSize;
gl->ShaderSource(shader, 1, const_cast<const char**>(&src), &size);
gl->CompileShader(shader);
return;
}
- const uint8_t* dataPtr = reinterpret_cast<const uint8_t*>(data);
-
- if(*(dataPtr + size - 1) != '\0')
- {
- sourcePreprocessed.resize(size + 1 /* Include null-terminated char */);
- sourcePreprocessed[size] = '\0';
- }
- else
- {
- // null-terminated char already included.
- sourcePreprocessed.resize(size);
- }
+ sourcePreprocessed.resize(size + 1 /* Include null-terminated char */);
+ sourcePreprocessed[size] = '\0';
- std::copy(dataPtr, dataPtr + size, sourcePreprocessed.data());
+ std::copy(reinterpret_cast<const uint8_t*>(data),
+ reinterpret_cast<const uint8_t*>(data) + size,
+ sourcePreprocessed.data());
}
EglGraphicsController& controller;
}
mFramebufferTextureDependencies.clear();
- for(uint32_t nativeIndex = 0u; nativeIndex < 2u; ++nativeIndex)
- {
- for(auto& nativeTextureDependency : mNativeTextureDependencies[nativeIndex])
- {
- if(nativeTextureDependency.agingSyncObject != nullptr)
- {
- mController.GetSyncPool().FreeSyncObject(nativeTextureDependency.agingSyncObject);
- }
- }
- mNativeTextureDependencies[nativeIndex].clear();
- }
+ // VD TRUNK-2025 block these codes
+ // for(uint32_t nativeIndex = 0u; nativeIndex < 2u; ++nativeIndex)
+ // {
+ // for(auto& nativeTextureDependency : mNativeTextureDependencies[nativeIndex])
+ // {
+ // mController.GetSyncPool().FreeSyncObject(nativeTextureDependency.agingSyncObject);
+ // }
+ // mNativeTextureDependencies[nativeIndex].clear();
+ // }
}
}
void TextureDependencyChecker::Reset()
}
mFramebufferTextureDependencies.clear();
- if(mNativeTextureDependencies[0].size() > 0 || mNativeTextureDependencies[1].size())
- {
- DALI_ASSERT_ALWAYS(mIsFirstPreparedNativeTextureDependency && "CreateNativeTextureSync should be called before PostRender!");
+ // VD TRUNK-2025 block these codes
- // Remove all infomations about previous native textures
- for(auto& nativeTextureDependency : mNativeTextureDependencies[mPreviousNativeTextureDependencyIndex])
- {
- if(nativeTextureDependency.agingSyncObject != nullptr)
- {
- mController.GetSyncPool().FreeSyncObject(nativeTextureDependency.agingSyncObject);
- }
- }
- mNativeTextureDependencies[mPreviousNativeTextureDependencyIndex].clear();
+ // if(mNativeTextureDependencies[0].size() > 0 || mNativeTextureDependencies[1].size())
+ // {
+ // DALI_ASSERT_ALWAYS(mIsFirstPreparedNativeTextureDependency && "CreateNativeTextureSync should be called before PostRender!");
- mCurrentNativeTextureDependencyIndex = __sync_fetch_and_xor(&mPreviousNativeTextureDependencyIndex, 1);
- }
+ // // Remove all infomations about previous native textures
+ // for(auto& nativeTextureDependency : mNativeTextureDependencies[mPreviousNativeTextureDependencyIndex])
+ // {
+ // mController.GetSyncPool().FreeSyncObject(nativeTextureDependency.agingSyncObject);
+ // }
+ // mNativeTextureDependencies[mPreviousNativeTextureDependencyIndex].clear();
+
+ // mCurrentNativeTextureDependencyIndex = __sync_fetch_and_xor(&mPreviousNativeTextureDependencyIndex, 1);
+ // }
}
void TextureDependencyChecker::AddTextures(const GLES::Context* writeContext, const GLES::Framebuffer* framebuffer)
}
}
- // Native dependency check
- if(texture->IsNativeTexture())
- {
- // TODO : Optimize here. For now, we don't have too much EndPass call. So just keep this logic.
- for(auto& nativeTextureDependency : mNativeTextureDependencies[mPreviousNativeTextureDependencyIndex])
- {
- if(nativeTextureDependency.synced)
- {
- // Fast-out if we know it is already synced
- continue;
- }
+ // VD TRUNK-2025 block these codes
- auto iter = nativeTextureDependency.textures.find(texture);
- if(iter != nativeTextureDependency.textures.end())
- {
- if(nativeTextureDependency.agingSyncObject != nullptr)
- {
- if(cpu)
- {
- DALI_LOG_INFO(gLogSyncFilter, Debug::Verbose, "TextureDependencyChecker::CheckNeedsSync (for native) Insert CPU WAIT");
- nativeTextureDependency.synced = mController.GetSyncPool().ClientWait(nativeTextureDependency.agingSyncObject);
+ // // Native dependency check
+ // if(texture->IsNativeTexture())
+ // {
+ // // TODO : Optimize here. For now, we don't have too much EndPass call. So just keep this logic.
+ // for(auto& nativeTextureDependency : mNativeTextureDependencies[mPreviousNativeTextureDependencyIndex])
+ // {
+ // if(nativeTextureDependency.synced)
+ // {
+ // // Fast-out if we know it is already synced
+ // continue;
+ // }
- if(DALI_LIKELY(nativeTextureDependency.synced) && readContext == nativeTextureDependency.agingSyncObject->writeContext)
- {
- // We can free sync object immediatly if we are using same context.
- mController.GetSyncPool().FreeSyncObject(nativeTextureDependency.agingSyncObject);
- nativeTextureDependency.agingSyncObject = nullptr;
- }
- }
- else
- {
- // Wait on the sync object in GPU. This will ensure that the writeContext completes its tasks prior
- // to the sync point.
- // However, this may instead timeout, and we can't tell the difference (at least, for glFenceSync)
- DALI_LOG_INFO(gLogSyncFilter, Debug::Verbose, "TextureDependencyChecker::CheckNeedsSync (for native) Insert GPU WAIT");
- mController.GetSyncPool().Wait(nativeTextureDependency.agingSyncObject);
- }
- }
+ // auto iter = nativeTextureDependency.textures.find(texture);
+ // if(iter != nativeTextureDependency.textures.end())
+ // {
+ // if(nativeTextureDependency.agingSyncObject != nullptr)
+ // {
+ // if(cpu)
+ // {
+ // DALI_LOG_INFO(gLogSyncFilter, Debug::Verbose, "TextureDependencyChecker::CheckNeedsSync (for native) Insert CPU WAIT");
+ // nativeTextureDependency.synced = mController.GetSyncPool().ClientWait(nativeTextureDependency.agingSyncObject);
+ // }
+ // else
+ // {
+ // // Wait on the sync object in GPU. This will ensure that the writeContext completes its tasks prior
+ // // to the sync point.
+ // // However, this may instead timeout, and we can't tell the difference (at least, for glFenceSync)
+ // DALI_LOG_INFO(gLogSyncFilter, Debug::Verbose, "TextureDependencyChecker::CheckNeedsSync (for native) Insert GPU WAIT");
+ // mController.GetSyncPool().Wait(nativeTextureDependency.agingSyncObject);
+ // }
+ // }
- nativeTextureDependency.textures.erase(iter);
- }
- }
- }
+ // nativeTextureDependency.textures.erase(iter);
+ // }
+ // }
+ // }
}
void TextureDependencyChecker::MarkNativeTexturePrepared(const GLES::Texture* texture)
{
- if(DALI_LIKELY(texture->IsNativeTexture()))
- {
- if(mIsFirstPreparedNativeTextureDependency)
- {
- mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].emplace_back();
- mIsFirstPreparedNativeTextureDependency = false;
- }
+ // VD TRUNK-2025 block these codes
+ // if(DALI_LIKELY(texture->IsNativeTexture()))
+ // {
+ // if(mIsFirstPreparedNativeTextureDependency)
+ // {
+ // mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].emplace_back();
+ // mIsFirstPreparedNativeTextureDependency = false;
+ // }
- if(DALI_LIKELY(!mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].empty()))
- {
- auto& nativeTextureDependency = mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].back();
- nativeTextureDependency.textures.insert(texture);
- }
- }
+ // if(DALI_LIKELY(!mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].empty()))
+ // {
+ // auto& nativeTextureDependency = mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].back();
+ // nativeTextureDependency.textures.insert(texture);
+ // }
+ // }
}
void TextureDependencyChecker::DiscardNativeTexture(const GLES::Texture* texture)
{
- if(DALI_LIKELY(texture->IsNativeTexture()))
- {
- for(uint32_t nativeIndex = 0u; nativeIndex < 2u; ++nativeIndex)
- {
- for(auto iter = mNativeTextureDependencies[nativeIndex].begin(); iter != mNativeTextureDependencies[nativeIndex].end();)
- {
- auto& nativeTextureDependency = *iter;
+ // VD TRUNK-2025 block these codes
+ // if(DALI_LIKELY(texture->IsNativeTexture()))
+ // {
+ // for(uint32_t nativeIndex = 0u; nativeIndex < 2u; ++nativeIndex)
+ // {
+ // for(auto iter = mNativeTextureDependencies[nativeIndex].begin(); iter != mNativeTextureDependencies[nativeIndex].end();)
+ // {
+ // auto& nativeTextureDependency = *iter;
- bool isErased = false;
+ // bool isErased = false;
- auto jter = nativeTextureDependency.textures.find(texture);
- if(jter != nativeTextureDependency.textures.end())
- {
- nativeTextureDependency.textures.erase(jter);
- if(nativeTextureDependency.textures.empty())
- {
- mController.GetSyncPool().FreeSyncObject(nativeTextureDependency.agingSyncObject);
- iter = mNativeTextureDependencies[nativeIndex].erase(iter);
+ // auto jter = nativeTextureDependency.textures.find(texture);
+ // if(jter != nativeTextureDependency.textures.end())
+ // {
+ // nativeTextureDependency.textures.erase(jter);
+ // if(nativeTextureDependency.textures.empty())
+ // {
+ // mController.GetSyncPool().FreeSyncObject(nativeTextureDependency.agingSyncObject);
+ // iter = mNativeTextureDependencies[nativeIndex].erase(iter);
- isErased = true;
- }
- }
+ // isErased = true;
+ // }
+ // }
- if(!isErased)
- {
- ++iter;
- }
- }
- }
- }
+ // if(!isErased)
+ // {
+ // ++iter;
+ // }
+ // }
+ // }
+ // }
}
void TextureDependencyChecker::CreateNativeTextureSync(const GLES::Context* writeContext)
{
- if(mIsFirstPreparedNativeTextureDependency)
- {
- return;
- }
+ // VD TRUNK-2025 block these codes
+ // if(mIsFirstPreparedNativeTextureDependency)
+ // {
+ // return;
+ // }
- // Reset flag
- mIsFirstPreparedNativeTextureDependency = true;
+ // // Reset flag
+ // mIsFirstPreparedNativeTextureDependency = true;
- if(DALI_LIKELY(!mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].empty()))
- {
- auto& nativeTextureDependency = mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].back();
+ // if(DALI_LIKELY(!mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].empty()))
+ // {
+ // auto& nativeTextureDependency = mNativeTextureDependencies[mCurrentNativeTextureDependencyIndex].back();
- DALI_LOG_INFO(gLogSyncFilter, Debug::Verbose, "TextureDependencyChecker::CreateNativeTextureSync() Allocating sync object\n");
- nativeTextureDependency.agingSyncObject = mController.GetSyncPool().AllocateSyncObject(writeContext, SyncPool::SyncContext::EGL);
- }
+ // DALI_LOG_INFO(gLogSyncFilter, Debug::Verbose, "TextureDependencyChecker::CreateNativeTextureSync() Allocating sync object\n");
+ // nativeTextureDependency.agingSyncObject = mController.GetSyncPool().AllocateSyncObject(writeContext, SyncPool::SyncContext::EGL);
+ // }
}
} // namespace Dali::Graphics::GLES
mCommandBuffer.endRenderPass();
}
-void CommandBufferImpl::ReadPixels(uint8_t* buffer)
-{
-}
-
void CommandBufferImpl::PipelineBarrier(
vk::PipelineStageFlags srcStageMask,
vk::PipelineStageFlags dstStageMask,
*/
void EndRenderPass();
- /**
- * Request to read pixels.
- */
- void ReadPixels(uint8_t* buffer);
-
void PipelineBarrier(vk::PipelineStageFlags srcStageMask,
vk::PipelineStageFlags dstStageMask,
vk::DependencyFlags dependencyFlags,
mCommandBufferImpl->EndRenderPass();
}
-void CommandBuffer::ReadPixels(uint8_t* buffer)
-{
- mCommandBufferImpl->ReadPixels(buffer);
-}
-
void CommandBuffer::ExecuteCommandBuffers(std::vector<const Graphics::CommandBuffer*>&& gfxCommandBuffers)
{
std::vector<vk::CommandBuffer> vkCommandBuffers;
*/
void EndRenderPass(Graphics::SyncObject* syncObject) override;
- /**
- * @copydoc Dali::Graphics::CommandBuffer::ReadPixels
- */
- void ReadPixels(uint8_t* buffer) override;
-
/**
* @brief Executes a list of secondary command buffers
*
return;
}
- const uint8_t* dataPtr = reinterpret_cast<const uint8_t*>(data);
+ sourcePreprocessed.resize(size + 1 /* Include null-terminated char */);
+ sourcePreprocessed[size] = '\0';
- if(*(dataPtr + size - 1) != '\0')
- {
- sourcePreprocessed.resize(size + 1 /* Include null-terminated char */);
- sourcePreprocessed[size] = '\0';
- }
- else
- {
- // null-terminated char already included.
- sourcePreprocessed.resize(size);
- }
-
- std::copy(dataPtr, dataPtr + size, sourcePreprocessed.data());
+ std::copy(reinterpret_cast<const uint8_t*>(data),
+ reinterpret_cast<const uint8_t*>(data) + size,
+ sourcePreprocessed.data());
}
VulkanGraphicsController& controller;
return success;
}
-bool NativeImageSourceAndroid::SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat)
-{
- return false;
-}
-
void NativeImageSourceAndroid::SetSource(Any source)
{
if(mPixmap)
*/
bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
- /**
- * @copydoc Dali::NativeImageSource::SetPixels()
- */
- bool SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat) override;
-
/**
* @copydoc Dali::NativeImageSource::SetSource( Any source )
*/
*/
virtual bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const = 0;
- /**
- * @copydoc Dali::NativeImageSource::SetPixels()
- */
- virtual bool SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat) = 0;
-
/**
* @copydoc Dali::NativeImageSource::SetSource( Any source )
*/
return true;
}
-bool NativeImageSourceCocoa::SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat)
-{
- return false;
-}
-
void NativeImageSourceCocoa::SetSource(Any source)
{
}
uint32_t& height,
Pixel::Format& pixelFormat) const override;
- /**
- * @copydoc Dali::NativeImageSource::SetPixels()
- */
- bool SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat) override;
-
/**
* @copydoc Dali::NativeImageSource::SetSource( Any source )
*/
return false;
}
-bool NativeImageSourceTizen::SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat)
-{
- std::scoped_lock lock(mMutex);
- if(mTbmSurface != NULL)
- {
- tbm_surface_info_s surface_info;
-
- if(tbm_surface_map(mTbmSurface, TBM_SURF_OPTION_READ | TBM_SURF_OPTION_WRITE, &surface_info) != TBM_SURFACE_ERROR_NONE)
- {
- DALI_LOG_ERROR("Fail to map tbm_surface\n");
- return false;
- }
- tbm_surface_internal_ref(mTbmSurface);
-
- if(pixelFormat != Pixel::Format::RGBA8888 && pixelFormat != Pixel::Format::RGB888)
- {
- DALI_LOG_ERROR("Not Supported PixelFormat\n");
- return false;
- }
-
- tbm_format format = surface_info.format;
- uint32_t stride = surface_info.planes[0].stride;
- uint8_t* ptr = surface_info.planes[0].ptr;
-
- size_t lineSize;
- size_t inputBufferLinePixelSize = Dali::Pixel::GetBytesPerPixel(pixelFormat);
-
- switch(format)
- {
- case TBM_FORMAT_RGB888:
- {
- lineSize = mWidth * inputBufferLinePixelSize;
- uint8_t* bufptr = &pixbuf[0];
-
- for(uint32_t r = 0; r < mHeight; ++r, bufptr += lineSize)
- {
- for(uint32_t c = 0; c < mWidth; ++c)
- {
- size_t sOffset = c * inputBufferLinePixelSize;
- size_t dOffset = c * 3;
- size_t offset = dOffset + r * stride;
- ptr[offset + 2] = *(bufptr + sOffset);
- ptr[offset + 1] = *(bufptr + sOffset + 1);
- ptr[offset] = *(bufptr + sOffset + 2);
- }
- }
- break;
- }
- case TBM_FORMAT_RGBA8888:
- {
- lineSize = mWidth * inputBufferLinePixelSize;
- uint8_t* bufptr = &pixbuf[0];
-
- for(uint32_t r = 0; r < mHeight; ++r, bufptr += lineSize)
- {
- for(uint32_t c = 0; c < mWidth; ++c)
- {
- size_t sOffset = c * inputBufferLinePixelSize;
- size_t dOffset = c * 4;
- size_t offset = dOffset + r * stride;
- ptr[offset + 3] = *(bufptr + sOffset);
- ptr[offset + 2] = *(bufptr + sOffset + 1);
- ptr[offset + 1] = *(bufptr + sOffset + 2);
- ptr[offset] = (inputBufferLinePixelSize == 4) ? *(bufptr + sOffset + 3) : 0xFF;
- }
- }
- break;
- }
- case TBM_FORMAT_ARGB8888:
- {
- lineSize = mWidth * inputBufferLinePixelSize;
- uint8_t* bufptr = &pixbuf[0];
-
- for(uint32_t r = 0; r < mHeight; ++r, bufptr += lineSize)
- {
- for(uint32_t c = 0; c < mWidth; ++c)
- {
- size_t sOffset = c * inputBufferLinePixelSize;
- size_t dOffset = c * 4;
- size_t offset = dOffset + r * stride;
- ptr[offset + 2] = *(bufptr + sOffset);
- ptr[offset + 1] = *(bufptr + sOffset + 1);
- ptr[offset] = *(bufptr + sOffset + 2);
- ptr[offset + 3] = (inputBufferLinePixelSize == 4) ? *(bufptr + sOffset + 3) : 0xFF;
- }
- }
- break;
- }
- default:
- {
- DALI_ASSERT_ALWAYS(0 && "Tbm surface has unsupported pixel format.\n");
-
- return false;
- }
- }
-
- if(tbm_surface_unmap(mTbmSurface) != TBM_SURFACE_ERROR_NONE)
- {
- DALI_LOG_ERROR("Fail to unmap tbm_surface\n");
- }
- tbm_surface_internal_unref(mTbmSurface);
-
- return true;
- }
-
- DALI_LOG_WARNING("TBM surface does not exist.\n");
-
- return false;
-}
-
void NativeImageSourceTizen::SetSource(Any source)
{
std::scoped_lock lock(mMutex);
*/
bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
- /**
- * @copydoc Dali::NativeImageSource::SetPixels()
- */
- bool SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat) override;
-
/**
* @copydoc Dali::NativeImageSource::SetSource( Any source )
*/
return success;
}
-bool NativeImageSourceX::SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat)
-{
- return false;
-}
-
void NativeImageSourceX::SetSource(Any source)
{
mPixmap = GetPixmapFromAny(source);
*/
bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
- /**
- * @copydoc Dali::NativeImageSource::SetPixels()
- */
- bool SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat) override;
-
/**
* @copydoc Dali::NativeImageSource::SetSource( Any source )
*/
return success;
}
-bool NativeImageSourceWin::SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat)
-{
- return false;
-}
-
void NativeImageSourceWin::SetSource(Any source)
{
mPixmap = GetPixmapFromAny(source);
*/
bool GetPixels(std::vector<uint8_t>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
- /**
- * @copydoc Dali::NativeImageSource::SetPixels()
- */
- bool SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat) override;
-
/**
* @copydoc Dali::NativeImageSource::SetSource( Any source )
*/
return success;
}
-bool NativeImageSourceX::SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat)
-{
- return false;
-}
-
void NativeImageSourceX::SetSource(Any source)
{
mPixmap = GetPixmapFromAny(source);
*/
bool GetPixels(std::vector<unsigned char>& pixbuf, uint32_t& width, uint32_t& height, Pixel::Format& pixelFormat) const override;
- /**
- * @copydoc Dali::NativeImageSource::SetPixels()
- */
- bool SetPixels(uint8_t* pixbuf, const Pixel::Format& pixelFormat) override;
-
/**
* @copydoc Dali::NativeImageSource::SetSource( Any source )
*/
// EXTERNAL INCLUDES
#include <dali/integration-api/debug.h>
-#include <dali/integration-api/pixel-data-integ.h>
#include <dali/public-api/common/vector-wrapper.h>
#include <dali/public-api/render-tasks/render-task-list.h>
#include <string.h>
namespace
{
static constexpr uint32_t ORDER_INDEX_CAPTURE_RENDER_TASK = 1000;
+constexpr int32_t SHADER_VERSION_NATIVE_IMAGE_SOURCE_AVAILABLE = 300;
constexpr uint32_t TIME_OUT_DURATION = 1000;
constexpr int32_t GL_VERSION_NATIVE_IMAGE_SOURCE_AVAILABLE = 30;
} // namespace
: mQuality(DEFAULT_QUALITY),
mTimer(),
mPath(),
+ mNativeImageSourcePtr(NULL),
mFileSave(false),
mUseDefaultCamera(true),
mSceneOffCameraAfterCaptureFinished(false)
mCameraActor(cameraActor),
mTimer(),
mPath(),
+ mNativeImageSourcePtr(NULL),
mFileSave(false),
mUseDefaultCamera(!cameraActor),
mSceneOffCameraAfterCaptureFinished(false)
{
Adaptor::Get().UnregisterProcessorOnce(*this, true);
}
+ DeleteNativeImageSource();
mTexture.Reset();
}
// Increase the reference count focely to avoid application mistake.
Reference();
- UnsetResources();
- SetupResources(position, size, clearColor, source);
-
mPath = path;
if(!mPath.empty())
{
mFileSave = true;
}
- mRenderTask.KeepRenderResult();
+
+ UnsetResources();
+ SetupResources(position, size, clearColor, source);
mInCapture = true;
Adaptor::Get().RegisterProcessorOnce(*this, true);
return mIsExclusive;
}
-Dali::NativeImageSourcePtr Capture::GetNativeImageSource()
+Dali::NativeImageSourcePtr Capture::GetNativeImageSource() const
{
- Dali::NativeImageSourcePtr result;
- if(mRenderTask)
- {
- Dali::PixelData pixelData = mRenderTask.GetRenderResult();
- if(pixelData)
- {
- auto pixelDataBuffer = Dali::Integration::GetPixelDataBuffer(pixelData);
- NativeImageSourcePtr nativeImageSourcePtr = Dali::NativeImageSource::New(pixelData.GetWidth(), pixelData.GetHeight(), Dali::NativeImageSource::COLOR_DEPTH_32); // Texture pixel format is RGBA8888
-
- if(Dali::DevelNativeImageSource::SetPixels(*nativeImageSourcePtr, pixelDataBuffer.buffer, pixelData.GetPixelFormat()))
- {
- result = nativeImageSourcePtr;
- }
- }
- }
- return result;
+ return mNativeImageSourcePtr;
}
Dali::Texture Capture::GetTexture() const
Dali::Devel::PixelBuffer Capture::GetCapturedBuffer()
{
- Devel::PixelBuffer pixelBuffer;
- if(mRenderTask)
+ if(!mPixelBuffer || (mPixelBuffer && !mPixelBuffer.GetBuffer()))
{
- Dali::PixelData pixelData = mRenderTask.GetRenderResult();
- if(pixelData)
+ std::vector<uint8_t> buffer;
+ uint32_t width, height;
+ Dali::Pixel::Format pixelFormat;
+ if(!mNativeImageSourcePtr->GetPixels(buffer, width, height, pixelFormat))
{
- auto pixelDataBuffer = Dali::Integration::GetPixelDataBuffer(pixelData);
- pixelBuffer = Dali::Devel::PixelBuffer::New(pixelData.GetWidth(), pixelData.GetHeight(), pixelData.GetPixelFormat());
- memcpy(pixelBuffer.GetBuffer(), pixelDataBuffer.buffer, pixelDataBuffer.bufferSize);
+ return Dali::Devel::PixelBuffer();
}
+ mPixelBuffer = Dali::Devel::PixelBuffer::New(width, height, pixelFormat);
+ memcpy(mPixelBuffer.GetBuffer(), &buffer[0], width * height * Dali::Pixel::GetBytesPerPixel(pixelFormat));
}
- return pixelBuffer;
+ return mPixelBuffer;
}
Dali::Capture::CaptureFinishedSignalType& Capture::FinishedSignal()
void Capture::CreateTexture(const Vector2& size)
{
- mTexture = Dali::Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, unsigned(size.width), unsigned(size.height));
+ if(!mNativeImageSourcePtr)
+ {
+ mNativeImageSourcePtr = Dali::NativeImageSource::New(size.width, size.height, Dali::NativeImageSource::COLOR_DEPTH_DEFAULT);
+ mTexture = Dali::Texture::New(*mNativeImageSourcePtr);
+ }
+}
+
+void Capture::DeleteNativeImageSource()
+{
+ if(mNativeImageSourcePtr)
+ {
+ mNativeImageSourcePtr.Reset();
+ }
}
void Capture::CreateFrameBuffer()
Dali::RenderTaskList taskList = sceneHolder.GetRenderTaskList();
taskList.RemoveTask(mRenderTask);
}
- mRenderTask.ClearRenderResult();
mRenderTask.Reset();
mSource.Reset();
- mTexture.Reset();
mSceneHolderHandle.Reset();
}
bool Capture::SaveFile()
{
- Dali::PixelData pixelData = mRenderTask.GetRenderResult();
- if(pixelData)
+ if(mNativeImageSourcePtr)
{
- auto pixelDataBuffer = Dali::Integration::GetPixelDataBuffer(pixelData);
- return Dali::EncodeToFile(pixelDataBuffer.buffer, mPath, pixelData.GetPixelFormat(), pixelData.GetWidth(), pixelData.GetHeight(), mQuality);
+ return Dali::DevelNativeImageSource::EncodeToFile(*mNativeImageSourcePtr, mPath, mQuality);
}
return false;
/**
* @copydoc Dali::Capture::GetNativeImageSource
*/
- Dali::NativeImageSourcePtr GetNativeImageSource();
+ Dali::NativeImageSourcePtr GetNativeImageSource() const;
/**
* @copydoc Dali::Capture::GetCapturedBuffer
*/
void CreateTexture(const Dali::Vector2& size);
+ /**
+ * @brief Delete native image source.
+ */
+ void DeleteNativeImageSource();
+
/**
* @brief Create frame buffer.
*/
Dali::Timer mTimer; ///< For timeout.
Dali::Capture::CaptureFinishedSignalType mFinishedSignal;
std::string mPath;
+ Dali::NativeImageSourcePtr mNativeImageSourcePtr; ///< pointer to surface image
+ Dali::Devel::PixelBuffer mPixelBuffer;
bool mInCapture{false};
bool mIsExclusive{false};
bool mFileSave;
// INTERNAL HEADERS
#include <dali/devel-api/adaptor-framework/accessibility-bridge.h>
-#include <dali/devel-api/adaptor-framework/actor-accessible.h>
+#include <dali/devel-api/atspi-interfaces/accessible.h>
#include <dali/integration-api/adaptor-framework/render-surface-interface.h>
#include <dali/internal/window-system/common/event-handler.h>
#include <dali/internal/window-system/common/orientation-impl.h>
if(Dali::Accessibility::IsUp())
{
- if(auto accessible = dynamic_cast<Accessibility::ActorAccessible*>(Accessibility::Accessible::Get(mScene.GetRootLayer())))
+ if(auto accessible = Dali::Accessibility::Accessible::Get(mScene.GetRootLayer()))
{
accessible->EmitBoundsChanged(Dali::Rect<>(oldRect.x, oldRect.y, size.GetWidth(), size.GetHeight()));
}
if(Dali::Accessibility::IsUp())
{
- if(auto accessible = dynamic_cast<Accessibility::ActorAccessible*>(Accessibility::Accessible::Get(mScene.GetRootLayer())))
+ if(auto accessible = Dali::Accessibility::Accessible::Get(mScene.GetRootLayer()))
{
accessible->EmitBoundsChanged(Dali::Rect<>(position.GetX(), position.GetY(), oldRect.width, oldRect.height));
}
if((moved || resize) && Dali::Accessibility::IsUp())
{
- if(auto accessible = dynamic_cast<Accessibility::ActorAccessible*>(Accessibility::Accessible::Get(mScene.GetRootLayer())))
+ if(auto accessible = Dali::Accessibility::Accessible::Get(mScene.GetRootLayer()))
{
accessible->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
}
if((moved || resize) && Dali::Accessibility::IsUp())
{
- if(auto accessible = dynamic_cast<Accessibility::ActorAccessible*>(Accessibility::Accessible::Get(mScene.GetRootLayer())))
+ if(auto accessible = Dali::Accessibility::Accessible::Get(mScene.GetRootLayer()))
{
accessible->EmitBoundsChanged(Dali::Rect<>(positionSize.x, positionSize.y, positionSize.width, positionSize.height));
}
// EXTERNAL_HEADERS
#include <dali/integration-api/debug.h>
-#include <tbm_bufmgr.h>
#include <tbm_dummy_display.h>
#ifdef ECORE_WAYLAND2
{
namespace Adaptor
{
-namespace
-{
-/**
- * @brief Helper class to make we keep NativeDisplay for NativeRenderSurface as unique pointer
- * even if Application terminated and restart again.
- *
- * @note Follow by eglSpec, eglGetDipslay() creates new EGLDisplay per each input paramater,
- * and never be deleted until process terminated. But we can re-create DisplayConnecter multiple times
- * when we are using OffscreenApplication.
- * So, we need to keep dummy NativeDisplay pointer to avoid creating multiple EGLDisplay.
- */
-struct NativeRenderSurfaceDisplayHolder
-{
- NativeRenderSurfaceDisplayHolder()
- : mBufMgr(nullptr),
- mDisplay(nullptr)
- {
- Initialize();
- }
- ~NativeRenderSurfaceDisplayHolder()
- {
- Destroy();
- }
-
- void Initialize()
- {
- mBufMgr = tbm_bufmgr_init(-1); // -1 is meaningless. The parameter in this function is deprecated.
- if(mBufMgr)
- {
- mDisplay = reinterpret_cast<NativeDisplayType>(tbm_dummy_display_create());
- }
- }
- void Destroy()
- {
-#ifdef VULKAN_ENABLED
- if(!mDisplay.Empty())
- {
- // TODO: Fix this call for Vulkan
- //tbm_dummy_display_destroy(mDisplay.Get<tbm_dummy_display>());
- }
-#else
- if(mDisplay)
- {
- tbm_dummy_display_destroy(reinterpret_cast<tbm_dummy_display*>(mDisplay));
- }
-#endif
- if(mBufMgr)
- {
- tbm_bufmgr_deinit(mBufMgr);
- }
- }
-
- tbm_bufmgr mBufMgr; ///< For creating tbm_dummy_display
-
- NativeDisplayType mDisplay;
-};
-
-static NativeDisplayType GetUniqueTbmDummyDisplay()
-{
- static NativeRenderSurfaceDisplayHolder sNativeRenderSurfaceDisplayHolder;
- if(sNativeRenderSurfaceDisplayHolder.mBufMgr == nullptr)
- {
- // Retry to initialize tbm bufmgr
- sNativeRenderSurfaceDisplayHolder.Destroy();
- sNativeRenderSurfaceDisplayHolder.Initialize();
- if(sNativeRenderSurfaceDisplayHolder.mBufMgr == nullptr)
- {
- DALI_LOG_ERROR("Fail to init tbm buf mgr\n");
- return nullptr;
- }
- }
- return sNativeRenderSurfaceDisplayHolder.mDisplay;
-}
-} // namespace
-
DisplayConnection* DisplayConnectionEcoreWl::New()
{
DisplayConnection* pDisplayConnection(new DisplayConnectionEcoreWl());
DisplayConnectionEcoreWl::DisplayConnectionEcoreWl()
: mDisplay(NULL),
- mSurfaceType(Integration::RenderSurfaceInterface::WINDOW_RENDER_SURFACE)
+ mSurfaceType(Integration::RenderSurfaceInterface::WINDOW_RENDER_SURFACE),
+ mBufMgr(nullptr)
{
}
NativeDisplayType DisplayConnectionEcoreWl::GetNativeDisplay()
{
- return GetUniqueTbmDummyDisplay();
+ mBufMgr = tbm_bufmgr_init(-1); // -1 is meaningless. The parameter in this function is deprecated.
+ if(mBufMgr == nullptr)
+ {
+ DALI_LOG_ERROR("Fail to init tbm buf mgr\n");
+ return nullptr;
+ }
+ return NativeDisplayType(tbm_dummy_display_create());
}
void DisplayConnectionEcoreWl::ReleaseNativeDisplay()
{
+#ifdef VULKAN_ENABLED
+ if(!mDisplay.Empty())
+ {
+ // TODO: Fix this call for Vulkan
+ //tbm_dummy_display_destroy(mDisplay.Get<tbm_dummy_display>());
+ }
+#else
+ if(mDisplay)
+ {
+ tbm_dummy_display_destroy(reinterpret_cast<tbm_dummy_display*>(mDisplay));
+ }
+#endif
+ if(mBufMgr != nullptr)
+ {
+ tbm_bufmgr_deinit(mBufMgr);
+ }
}
} // namespace Adaptor
*/
// EXTERNAL INCLUDES
+#include <tbm_bufmgr.h>
// INTERNAL INCLUDES
#include <dali/internal/window-system/common/display-connection-impl.h>
private:
NativeDisplayType mDisplay; ///< Wayland-display for rendering
Dali::Integration::RenderSurfaceInterface::Type mSurfaceType; ///< The surface type
+ tbm_bufmgr mBufMgr; ///< For creating tbm_dummy_display
};
} // namespace Adaptor
return GetImpl(*this).IsExclusive();
}
-Dali::NativeImageSourcePtr Capture::GetNativeImageSource()
+Dali::NativeImageSourcePtr Capture::GetNativeImageSource() const
{
return GetImpl(*this).GetNativeImageSource();
}
* @SINCE_1_9.10
*
* @return NativeImageSourcePtr Captured result that can be rendered with DALi
- * @note GetNativeImageSource is only available inside FinishedSignal.
*/
- Dali::NativeImageSourcePtr GetNativeImageSource();
+ Dali::NativeImageSourcePtr GetNativeImageSource() const;
/**
* @brief Get Texture of captured image.
*
* @return Texture Captured result
- * @note GetTexture is only available inside FinishedSignal.
*/
Dali::Texture GetTexture() const;