Browse Source

[culling] Add debug option to ignore clip rectangles

pull/28/head
Emil Ernerfeldt 4 years ago
parent
commit
f30b354f77
  1. 16
      egui/src/context.rs
  2. 9
      egui/src/paint/tessellator.rs

16
egui/src/context.rs

@ -617,11 +617,21 @@ impl Context {
impl paint::PaintOptions {
pub fn ui(&mut self, ui: &mut Ui) {
let Self {
anti_alias,
aa_size: _,
debug_paint_clip_rects,
debug_ignore_clip_rects,
} = self;
use crate::widgets::*;
ui.add(Checkbox::new(&mut self.anti_alias, "Antialias"));
ui.add(Checkbox::new(anti_alias, "Antialias"));
ui.add(Checkbox::new(
&mut self.debug_paint_clip_rects,
"Paint Clip Rects (debug)",
debug_paint_clip_rects,
"Paint clip rectangles (debug)",
));
ui.add(Checkbox::new(
debug_ignore_clip_rects,
"Ignore clip rectangles (debug)",
));
}
}

9
egui/src/paint/tessellator.rs

@ -438,6 +438,8 @@ pub struct PaintOptions {
pub aa_size: f32,
/// Output the clip rectangles to be painted?
pub debug_paint_clip_rects: bool,
/// If true, no clipping will be done
pub debug_ignore_clip_rects: bool,
}
impl Default for PaintOptions {
@ -446,6 +448,7 @@ impl Default for PaintOptions {
anti_alias: true,
aa_size: 1.0,
debug_paint_clip_rects: false,
debug_ignore_clip_rects: false,
}
}
}
@ -829,5 +832,11 @@ pub fn tessellate_paint_commands(
}
}
if options.debug_ignore_clip_rects {
for (clip_rect, _) in &mut jobs {
*clip_rect = Rect::everything();
}
}
jobs
}

Loading…
Cancel
Save