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

Use explicit Arc::clone to clarify when clones are cheap (#7784)

This commit is contained in:
Emil Ernerfeldt
2025-12-17 17:19:18 +01:00
committed by GitHub
parent 6157a35985
commit 986c2c0ffb
40 changed files with 80 additions and 71 deletions

View File

@@ -1,3 +1,5 @@
use std::sync::Arc;
use egui::{TexturesDelta, UserData, ViewportCommand};
use crate::{App, epi, web::web_painter::WebPainter};
@@ -12,7 +14,7 @@ pub struct AppRunner {
painter: Box<dyn WebPainter>,
pub(crate) input: super::WebInput,
app: Box<dyn epi::App>,
pub(crate) needs_repaint: std::sync::Arc<NeedRepaint>,
pub(crate) needs_repaint: Arc<NeedRepaint>,
last_save_time: f64,
pub(crate) text_agent: TextAgent,
@@ -63,7 +65,7 @@ impl AppRunner {
canvas,
&web_options,
)?;
gl = Some(painter.gl().clone());
gl = Some(Arc::clone(painter.gl()));
Box::new(painter) as Box<dyn WebPainter>
}
@@ -138,10 +140,9 @@ impl AppRunner {
wgpu_render_state,
};
let needs_repaint: std::sync::Arc<NeedRepaint> =
std::sync::Arc::new(NeedRepaint::new(web_options.max_fps));
let needs_repaint: Arc<NeedRepaint> = Arc::new(NeedRepaint::new(web_options.max_fps));
{
let needs_repaint = needs_repaint.clone();
let needs_repaint = Arc::clone(&needs_repaint);
egui_ctx.set_request_repaint_callback(move |info| {
needs_repaint.repaint_after(info.delay.as_secs_f64());
});