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

refactor: Use constants from Twips where appropriate #19061

Merged
merged 4 commits into from
Jan 4, 2025

Conversation

kjarosh
Copy link
Member

@kjarosh kjarosh commented Dec 25, 2024

It's a refactor that replaces Twips instantiations with respective constants. Some instantiations in tests (by Twips::new) were left intact as they seem to focus on the pure numerical value instead of semantically the number of twips.

@kjarosh kjarosh added A-other Area: Not covered by other area labels T-refactor Type: Refactor / Cleanup labels Dec 25, 2024
@torokati44
Copy link
Member

For some reason, reading Twips::ONE in itself, it's not obvious to me that it's in fact one pixel's worth of twips, and not one twip...

@kjarosh
Copy link
Member Author

kjarosh commented Dec 26, 2024

For some reason, reading Twips::ONE in itself, it's not obvious to me that it's in fact one pixel's worth of twips, and not one twip...

Yeah... That's a bit confusing. I don't have a proposal of a better name though... :/ ONE_PIXEL is kinda long

@n0samu
Copy link
Member

n0samu commented Dec 26, 2024

I had the same confusion and was thinking of bringing it up too. How about ONEPX? (Or ONE_PX if you prefer)

Copy link
Contributor

@danielhjacobs danielhjacobs left a comment

Choose a reason for hiding this comment

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

Bikeshedding aside, LGTM

@evilpie
Copy link
Collaborator

evilpie commented Jan 4, 2025

I like ONE_PX as well. Let's get this done.

Twips::ONE was ambiguous, because it suggested
it's 1 twips, but it was 1 px instead.
Similarly to Twips::ONE_PX, this name change makes it obvious
it's half a pixel, not half a twip.
@kjarosh kjarosh merged commit 7638326 into ruffle-rs:master Jan 4, 2025
22 checks passed
@kjarosh kjarosh deleted the twips-const branch January 4, 2025 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-other Area: Not covered by other area labels T-refactor Type: Refactor / Cleanup
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants