misc code cleanup
This commit is contained in:
parent
b0fa0c65cc
commit
4e8a6e3370
6 changed files with 28 additions and 12 deletions
|
@ -106,6 +106,7 @@ impl Placer {
|
||||||
/// This is what you then pass to `advance_after_rects`.
|
/// This is what you then pass to `advance_after_rects`.
|
||||||
/// Use `justify_and_align` to get the inner `widget_rect`.
|
/// Use `justify_and_align` to get the inner `widget_rect`.
|
||||||
pub(crate) fn next_space(&self, child_size: Vec2, item_spacing: Vec2) -> Rect {
|
pub(crate) fn next_space(&self, child_size: Vec2, item_spacing: Vec2) -> Rect {
|
||||||
|
egui_assert!(child_size.is_finite() && child_size.x >= 0.0 && child_size.y >= 0.0);
|
||||||
self.region.sanity_check();
|
self.region.sanity_check();
|
||||||
if let Some(grid) = &self.grid {
|
if let Some(grid) = &self.grid {
|
||||||
grid.next_cell(self.region.cursor, child_size)
|
grid.next_cell(self.region.cursor, child_size)
|
||||||
|
|
|
@ -142,13 +142,6 @@ impl BackendPanel {
|
||||||
if ui.button("Quit").clicked() {
|
if ui.button("Quit").clicked() {
|
||||||
frame.quit();
|
frame.quit();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ui
|
|
||||||
.button("Drag me to drag window")
|
|
||||||
.is_pointer_button_down_on()
|
|
||||||
{
|
|
||||||
frame.drag_window();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -191,9 +184,18 @@ impl BackendPanel {
|
||||||
{
|
{
|
||||||
// frame.set_window_size(egui::vec2(375.0, 812.0)); // iPhone 12 mini
|
// frame.set_window_size(egui::vec2(375.0, 812.0)); // iPhone 12 mini
|
||||||
frame.set_window_size(egui::vec2(375.0, 667.0)); // iPhone SE 2nd gen
|
frame.set_window_size(egui::vec2(375.0, 667.0)); // iPhone SE 2nd gen
|
||||||
|
frame.set_fullscreen(false);
|
||||||
ui.close_menu();
|
ui.close_menu();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if !frame.info().window_info.fullscreen
|
||||||
|
&& ui
|
||||||
|
.button("Drag me to drag window")
|
||||||
|
.is_pointer_button_down_on()
|
||||||
|
{
|
||||||
|
frame.drag_window();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,16 @@ impl RetainedImage {
|
||||||
self.size
|
self.size
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The width of the image.
|
||||||
|
pub fn width(&self) -> usize {
|
||||||
|
self.size[0]
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The height of the image.
|
||||||
|
pub fn height(&self) -> usize {
|
||||||
|
self.size[1]
|
||||||
|
}
|
||||||
|
|
||||||
/// The size of the image data (number of pixels wide/high).
|
/// The size of the image data (number of pixels wide/high).
|
||||||
pub fn size_vec2(&self) -> egui::Vec2 {
|
pub fn size_vec2(&self) -> egui::Vec2 {
|
||||||
let [w, h] = self.size();
|
let [w, h] = self.size();
|
||||||
|
|
|
@ -468,6 +468,8 @@ impl Painter {
|
||||||
}
|
}
|
||||||
|
|
||||||
check_for_gl_error!(&self.gl, "paint_mesh");
|
check_for_gl_error!(&self.gl, "paint_mesh");
|
||||||
|
} else {
|
||||||
|
tracing::warn!("Failed to find texture {:?}", mesh.texture_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1058,10 +1058,11 @@ impl Tessellator {
|
||||||
None => true,
|
None => true,
|
||||||
Some(output_clipped_primitive) => {
|
Some(output_clipped_primitive) => {
|
||||||
output_clipped_primitive.clip_rect != new_clip_rect
|
output_clipped_primitive.clip_rect != new_clip_rect
|
||||||
|| if let Primitive::Mesh(output_mesh) = &output_clipped_primitive.primitive {
|
|| match &output_clipped_primitive.primitive {
|
||||||
output_mesh.texture_id != new_shape.texture_id()
|
Primitive::Mesh(output_mesh) => {
|
||||||
} else {
|
output_mesh.texture_id != new_shape.texture_id()
|
||||||
true
|
}
|
||||||
|
Primitive::Callback(_) => true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -62,8 +62,8 @@ cargo deny check
|
||||||
# Also try https://github.com/google/bloaty
|
# Also try https://github.com/google/bloaty
|
||||||
|
|
||||||
# what compiles slowly?
|
# what compiles slowly?
|
||||||
|
# cargo clean && time cargo build -p eframe --timings
|
||||||
# https://fasterthanli.me/articles/why-is-my-rust-build-so-slow
|
# https://fasterthanli.me/articles/why-is-my-rust-build-so-slow
|
||||||
# (cd egui_demo_app && cargo clean && RUSTC_BOOTSTRAP=1 cargo build --release --quiet -Z timings)
|
|
||||||
|
|
||||||
# what compiles slowly?
|
# what compiles slowly?
|
||||||
# cargo llvm-lines --lib -p egui | head -20
|
# cargo llvm-lines --lib -p egui | head -20
|
||||||
|
|
Loading…
Reference in a new issue