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

Use some typed units in compositor and windowing. #2444

Closed
wants to merge 3 commits into from

Conversation

@mbrubeck
Copy link
Contributor

mbrubeck commented May 15, 2014

This is a first step to convert a small subset of Servo code to use type-checked unit conversions (#2226). It depends on servo/euclid#35.

Specifically, it adds types for the three different "pixel" units used in the compositor, and uses the type system to check that the proper conversions are used before passing values of one type to a function expecting a different type. See the comments in geometry.rs for details.

Functions like to_untyped are used when passing values to code that has not yet been updated to use typed units. Eventually most or all of these calls will be removed as more code is converted.

@hoppipolla-critic-bot
Copy link

hoppipolla-critic-bot commented May 15, 2014

Critic review: https://critic.hoppipolla.co.uk/r/1574

This is an external review system which you may optionally use for the code review of your pull request.

In order to help critic track your changes, please do not make in-place history rewrites (e.g. via git rebase -i or git commit --amend) when updating this pull request.

@mbrubeck
Copy link
Contributor Author

mbrubeck commented May 15, 2014

Based on conversation with @pcwalton in servo/euclid#35 and IRC, I'm planning to use typedefs to replace many of the complex types signatures here with more readable aliases (like PagePoint instead of TypedPoint2D<PagePx, f32>).

@mbrubeck
Copy link
Contributor Author

mbrubeck commented Jun 6, 2014

Rebasing this made the intermediate commits fail to build without significant changes; rather than clutter this PR further, I've submitted a new rebase/squashed/updated PR #2603.

@mbrubeck mbrubeck closed this Jun 6, 2014
bors-servo pushed a commit that referenced this pull request Jun 6, 2014
This is a rebased, squashed, and updated version of #2444.
@mbrubeck mbrubeck deleted the mbrubeck:length branch Jun 24, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.