-
Notifications
You must be signed in to change notification settings - Fork 8.4k
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
til::size #4850
til::size #4850
Conversation
Nnnnn I don't think I checked SA here and it's not used in an SA-enabled project yet. I should do that. |
…since we already did division (for perf reasons, per PR.)
OH. I should put a natvis on this too, eh, @DHowett-MSFT? |
i do like me some good natvisses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Is this possible to use in a clamped context?
- Should this maybe be
til::vec2
that exposes bothwidth()
andx()
(for example)?
Is there a way I use this for clamped math? Would I just have to catch the HRESULT after each operation? It'd be nice if I could just say "always clamp to these dimensions" (i.e. text buffer size), and it would "just work". But that might also be outside the scope of this PR. Thoughts? EDIT: derp. zadji mentioned it in the comment just before mine... |
No, not yet. I didn't need that yet... so I didn't put it in.
What you're not seeing yet is that |
I don't have a clamped one yet because I didn't have a specific use case in my mind yet and I was trying not to write this class forever. If we have a use for clamped, then we can add it. This isn't the end of writing Maybe it takes an optional bool parameter on the constructors that sets it to clamped mode instead of checked mode? We can figure that out in a future revision, IMO. |
Hello @miniksa! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
## Summary of the Pull Request Introduces convenience type `til::size` which automatically implements our best practices for size-related types and provides automatic conversions in/out of the relevant types. ## PR Checklist * [x] In support of Differental Rendering microsoft#778 * [X] I work here. * [x] Tests added/passed * [x] I'm a core contributor. ## Detailed Description of the Pull Request / Additional comments - Automatically converts in from anything with a X/Y (console `COORD`) or cx/cy (Win32 `SIZE`) - Automatically converts out to `COORD`, `SIZE`, or `D2D1_SIZE_F`. - Constructs from bare integers written into source file - Default constructs to empty - Uses Chromium Math for all basic math operations (+, -, *, /) - Provides equality tests - Adds initial proposal for division-to-ceiling (round up division) that attempts to `ceil` without any floating point math. - Accessors for height/width - Type converting accessors (that use safe conversions and throw) for height/width - Convenience function for area calculation (as that's common with type) and uses safe math to do it. - TAEF/WEX Output and Comparators so they will print very nicely with `VERIFY` and `Log` macros in our testing suite. ## Validation Steps Performed - See automated tests of functionality.
Summary of the Pull Request
Introduces convenience type
til::size
which automatically implements our best practices for size-related types and provides automatic conversions in/out of the relevant types.PR Checklist
Detailed Description of the Pull Request / Additional comments
COORD
) or cx/cy (Win32SIZE
)COORD
,SIZE
, orD2D1_SIZE_F
.ceil
without any floating point math.VERIFY
andLog
macros in our testing suite.Validation Steps Performed