Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NUI] Refactoring ControlState to use bitmask #6530

Open
wants to merge 1 commit into
base: DevelNUI
Choose a base branch
from

Conversation

everLEEst
Copy link
Contributor

ControlState was implemented inefficently on the memory and the performance. This patch purposed to reduce inefficency by using bitflags on the state instead of string list. [https://github.sec.samsung.net/NUI/OneUIComponents/issues/15]

long type bitmask will be represent each states,
1 1 1 1 1
O S D P F

Normal : 0L
Focused : 1L
Pressed : 2L
Disabled : 4L
Selected : 8L
Other : 16L
and All : 31L

This concept is based on VisualState of NUI2,
https://github.sec.samsung.net/dotnet/nui2/blob/main/src/Tizen.NUI2.Components/Base/ViewState.cs but we had to modified few states to keep backward compatibility of NUI ControlState.

Description of Change

API Changes

  • ACR:

@everLEEst
Copy link
Contributor Author

everLEEst commented Dec 27, 2024

I've tested this on NUITizenGallery and works with no issue,
but we need to test more various cases including TCT and real applications.

Please check the state and bit max is good enough including Other states.

while I made this patch,
I had some conclusion that this way of change will break backward compatibility as listed state can be expanded infinitely but bitmask doesn't. allow this break or not is one of the biggest issue on this patch.

@TizenAPI-Bot
Copy link
Collaborator

Public API Changed

Please follow the ACR process for the changed API below.

Added: 1, Removed: 0, Changed: 3

Added

+ /// <since_tizen>none</since_tizen
+ static Tizen.NUI.BaseComponents.ControlState Tizen.NUI.BaseComponents.ControlState::op_Subtraction(Tizen.NUI.BaseComponents.ControlState,Tizen.NUI.BaseComponents.ControlState)

Changed

- /// <since_tizen>9</since_tizen
+ /// <since_tizen>none</since_tizen
static System.Boolean Tizen.NUI.BaseComponents.ControlState::op_Equality(Tizen.NUI.BaseComponents.ControlState,Tizen.NUI.BaseComponents.ControlState)

- /// <since_tizen>9</since_tizen
+ /// <since_tizen>none</since_tizen
static System.Boolean Tizen.NUI.BaseComponents.ControlState::op_Inequality(Tizen.NUI.BaseComponents.ControlState,Tizen.NUI.BaseComponents.ControlState)

- /// <since_tizen>9</since_tizen
+ /// <since_tizen>none</since_tizen
static Tizen.NUI.BaseComponents.ControlState Tizen.NUI.BaseComponents.ControlState::op_Addition(Tizen.NUI.BaseComponents.ControlState,Tizen.NUI.BaseComponents.ControlState)

Internal API Changed

Added: 0, Removed: 1, Changed: 0

Removed

- /// <since_tizen>none</since_tizen
- [EditorBrowsable(EditorBrowsableState.Never)]
- static Tizen.NUI.BaseComponents.ControlState Tizen.NUI.BaseComponents.ControlState::op_Subtraction(Tizen.NUI.BaseComponents.ControlState,Tizen.NUI.BaseComponents.ControlState)

ControlState was implemented inefficently on the memory and the performance.
This patch purposed to reduce inefficency by using bitflags on the state instead of string list.
[https://github.sec.samsung.net/NUI/OneUIComponents/issues/15]

long type bitmask will be represent each states,
1 1 1 1 1
O S D P F

Normal   : 0L
Focused  : 1L
Pressed  : 2L
Disabled : 4L
Selected : 8L
Other    : 16L
and All  : 31L

This concept is based on VisualState of NUI2,
https://github.sec.samsung.net/dotnet/nui2/blob/main/src/Tizen.NUI2.Components/Base/ViewState.cs
but we had to modified few states to keep backward compatibility of NUI
ControlState.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants