Skip to content

Nickez/ugui no inverse#1975

Open
NickeZ wants to merge 5 commits into
BitBoxSwiss:masterfrom
NickeZ:nickez/ugui-no-inverse
Open

Nickez/ugui no inverse#1975
NickeZ wants to merge 5 commits into
BitBoxSwiss:masterfrom
NickeZ:nickez/ugui-no-inverse

Conversation

@NickeZ
Copy link
Copy Markdown
Collaborator

@NickeZ NickeZ commented May 18, 2026

I want to remove inverted because multi-byte encodings like utf8 are not trivial to traverse backwards.

remove inverted, transparent and null checks in release mode.

  • inverted is only used once (orientation screen)
  • transparent is never used
  • no need to do null-checks in release builds. Especially not confusing "silently fail" ones.

These all are things that we have added and are not part of the original ugui:

https://github.com/achimdoebler/UGUI/blob/ce0bccb5b7d4877c42081419fccadf7aa5727303/ugui.c#L60

NickeZ added 3 commits May 18, 2026 14:32
Replace the text-specific inverted flag with a temporary 180-degree UG
rendering transform. Use the component helper to rotate the orientation
screen top button while keeping normal text drawing APIs.

Update C and Rust call sites and add coverage for pixel and component
rotation.
Drop the unused UG_PutCharTransparent entry point and the now-constant
transparent flag from the private character renderer.
Replace defensive null-check returns in ugui.c with ASSERT() calls.
ASSERT is already compiled as a no-op outside DEBUG builds, so release
behavior no longer carries the extra null-check branches.
@NickeZ NickeZ force-pushed the nickez/ugui-no-inverse branch from 894c10a to c63cd97 Compare May 18, 2026 12:32
Render the orientation screen's reverse logo state by rotating the
existing logo component 180 degrees instead of keeping a second reversed
bitmap and component.
@NickeZ NickeZ requested a review from benma May 18, 2026 12:41
Set up a minimal ugui instance for UI component tests that create
labels. Label sizing now relies on ugui being initialized because ugui
null guards are debug assertions instead of release-time early returns.
Copy link
Copy Markdown
Collaborator

@benma benma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer keeping the NULL checks, they don't really hurt right? And if a refactor or sth smuggles in a NULL it would help.

Fyi: the rotated orientation screen label is not exactly the same as before, but moved by one pixel:

  Measured ink bounding boxes:

  before top:    x=35..95, y=1..10
  before bottom: x=33..93, y=54..63

  after top:     x=34..94, y=0..9
  after bottom:  x=33..93, y=54..63

orientation_tap_before_323f_parent.bmp
orientation_tap_after_323f.bmp

I guess that is better than before, now it actually looks the same when viewed from either side.

tACK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants