1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00

Fix sometimes blurry SVGs (#7071)

* Closes https://github.com/emilk/egui/issues/3501

The problem occurs when you want to render the same SVG at different
scales, either at the same time in different parts of your UI, or at two
different times (e.g. the DPI changes).

The solution is to use the `SizeHint` as part of the key.

However, when you have an SVG in a resizable container, that can lead to
hundreds of versions of the same SVG. So new eviction code is added to
handle this case.
This commit is contained in:
Emil Ernerfeldt
2025-05-21 20:01:40 +02:00
committed by GitHub
parent b05a40745f
commit b8334f365b
7 changed files with 219 additions and 30 deletions

View File

@@ -21,6 +21,13 @@ impl<T: Float + Copy> OrderedFloat<T> {
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for OrderedFloat<T> {
#[inline]
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
self.0.fmt(f)
}
}
impl<T: Float> Eq for OrderedFloat<T> {}
impl<T: Float> PartialEq<Self> for OrderedFloat<T> {