Remove Pixels: Mul<Pixels, Output = Pixels> impl, add ScaledPixels ops (#27451)

It doesn't make sense to have `Pixels: Mul<Pixels, Output = Pixels>` as
the output should be `Pixels^2` (area), so these impls are removed. All
code where these impls were used are improved by instead multiplying by
`f32` or `usize`.

Also adds math op impls that are present for `Pixels` but absent for
`ScaledPixels`. Adds missing `Mul<Pixels> for usize` to both.

Release Notes:

- N/A
This commit is contained in:
Michael Sloan 2025-03-25 13:34:26 -06:00 committed by GitHub
parent 581d67398a
commit 9fc570c4be
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 120 additions and 56 deletions

View file

@ -662,7 +662,8 @@ impl Element for TerminalElement {
let dimensions = {
let rem_size = window.rem_size();
let font_pixels = text_style.font_size.to_pixels(rem_size);
let line_height = font_pixels * line_height.to_pixels(rem_size);
// TODO: line_height should be an f32 not an AbsoluteLength.
let line_height = font_pixels * line_height.to_pixels(rem_size).0;
let font_id = cx.text_system().resolve_font(&text_style.font());
let cell_width = text_system