mirror of
https://github.com/emilk/egui.git
synced 2026-08-31 13:50:04 -04:00
Speed up fractal_clock painting (#152)
clip unwatchable line before drawing
This commit is contained in:
@@ -91,6 +91,14 @@ impl Rect {
|
||||
max: pos2(*x_range.end(), *y_range.end()),
|
||||
}
|
||||
}
|
||||
pub fn from_two_pos(a: Pos2, b: Pos2) -> Self {
|
||||
let (left, right) = if a.x > b.x { (b.x, a.x) } else { (a.x, b.x) };
|
||||
let (top, bottom) = if a.y > b.y { (b.y, a.y) } else { (a.y, b.y) };
|
||||
Rect {
|
||||
min: pos2(left, top),
|
||||
max: pos2(right, bottom),
|
||||
}
|
||||
}
|
||||
|
||||
/// Expand by this much in each direction, keeping the center
|
||||
#[must_use]
|
||||
|
||||
Reference in New Issue
Block a user