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

Shape refactor (#705)

* More introspection stats about vertices/indices etc

* more serde derive

* #[inline] to Shape constructors

* Introduce RectShape

* Introduce CircleShape

* Introduce PathShape

* More serde derive

* impl Copy for RectShape and CircleShape

* Simplify some code

* More serde derive

* Add helpers for appending more input or output

* Serde derives for RawInput

* Rename Fonts::from_definitions to Fonts::new

* Add Output::take

* refactor EguiGlium slightly

* Derive PartialEq for RawInput

* Improve egui::util::History interface

* tweaks

* Improve History filter: add minimum length

* Calculate galley bounding rect

* tessellator: cull line segments and paths

* tessellator: cull meshes

* Fix bug in History bandwidth estimator
This commit is contained in:
Emil Ernerfeldt
2021-09-20 21:36:56 +02:00
committed by GitHub
parent 93c2fde1fc
commit e7cfda4941
36 changed files with 578 additions and 313 deletions

View File

@@ -118,7 +118,6 @@ pub struct FontDefinitions {
///
/// `epaint` has built-in-default for these,
/// but you can override them if you like.
#[cfg_attr(feature = "persistence", serde(skip))]
pub font_data: BTreeMap<String, FontData>,
/// Which fonts (names) to use for each [`FontFamily`].
@@ -219,7 +218,7 @@ pub struct Fonts {
}
impl Fonts {
pub fn from_definitions(pixels_per_point: f32, definitions: FontDefinitions) -> Self {
pub fn new(pixels_per_point: f32, definitions: FontDefinitions) -> Self {
assert!(
0.0 < pixels_per_point && pixels_per_point < 100.0,
"pixels_per_point out of range: {}",
@@ -278,6 +277,11 @@ impl Fonts {
}
}
#[deprecated = "Renamed to Fonts::new"]
pub fn from_definitions(pixels_per_point: f32, definitions: FontDefinitions) -> Self {
Self::new(pixels_per_point, definitions)
}
#[inline(always)]
pub fn pixels_per_point(&self) -> f32 {
self.pixels_per_point