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

Added App::clear_color() that apps can use to specify background color

This commit is contained in:
Emil Ernerfeldt
2020-12-18 22:34:48 +01:00
parent 9ea8d907fd
commit c3c4f28a9d
6 changed files with 33 additions and 11 deletions

View File

@@ -111,7 +111,13 @@ pub fn run(mut storage: Box<dyn egui::app::Storage>, mut app: Box<dyn App>) -> !
let frame_time = (Instant::now() - egui_start).as_secs_f64() as f32;
previous_frame_time = Some(frame_time);
painter.paint_jobs(&display, ctx.pixels_per_point(), paint_jobs, &ctx.texture());
painter.paint_jobs(
&display,
ctx.pixels_per_point(),
app.clear_color(),
paint_jobs,
&ctx.texture(),
);
{
let egui::app::AppOutput {

View File

@@ -126,6 +126,7 @@ impl Painter {
&mut self,
display: &glium::Display,
pixels_per_point: f32,
clear_color: egui::Rgba,
jobs: PaintJobs,
egui_texture: &egui::Texture,
) {
@@ -133,7 +134,13 @@ impl Painter {
self.upload_pending_user_textures(display);
let mut target = display.draw();
target.clear_color(0.0, 0.0, 0.0, 0.0);
// Verified to be gamma-correct.
target.clear_color(
clear_color[0],
clear_color[1],
clear_color[2],
clear_color[3],
);
for (clip_rect, triangles) in jobs {
self.paint_job(
&mut target,