1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 14:20:04 -04:00

Simplify backends by adding fn paint_and_update_textures helper

This commit is contained in:
Emil Ernerfeldt
2022-02-21 21:49:52 +01:00
parent 8f887e2ebd
commit 0a46634c13
7 changed files with 73 additions and 42 deletions

View File

@@ -270,6 +270,25 @@ impl Painter {
(width_in_pixels, height_in_pixels)
}
pub fn paint_and_update_textures(
&mut self,
gl: &glow::Context,
inner_size: [u32; 2],
pixels_per_point: f32,
clipped_meshes: Vec<egui::ClippedMesh>,
textures_delta: &egui::TexturesDelta,
) {
for (id, image_delta) in &textures_delta.set {
self.set_texture(gl, *id, image_delta);
}
self.paint_meshes(gl, inner_size, pixels_per_point, clipped_meshes);
for &id in &textures_delta.free {
self.free_texture(gl, id);
}
}
/// Main entry-point for painting a frame.
/// You should call `target.clear_color(..)` before
/// and `target.finish()` after this.