1
0
Fork 0
forked from wry/wry

rect: safer construction

This commit is contained in:
Stipe Kotarac 2025-12-29 10:42:17 +01:00 committed by Julian Orth
parent 411af0ea18
commit a1dfc473a2
33 changed files with 245 additions and 159 deletions

View file

@ -374,7 +374,7 @@ impl PangoLayout {
let mut rect = PangoRectangle::default();
pango_layout_get_extents(self.l, &mut rect, ptr::null_mut());
pango_extents_to_pixels(&mut rect, ptr::null_mut());
Rect::new_sized(rect.x, rect.y, rect.width, rect.height).unwrap()
Rect::new_sized_saturating(rect.x, rect.y, rect.width, rect.height)
}
}
@ -383,7 +383,7 @@ impl PangoLayout {
let mut rect = PangoRectangle::default();
pango_layout_get_extents(self.l, ptr::null_mut(), &mut rect);
pango_extents_to_pixels(&mut rect, ptr::null_mut());
Rect::new_sized(rect.x, rect.y, rect.width, rect.height).unwrap()
Rect::new_sized_saturating(rect.x, rect.y, rect.width, rect.height)
}
}