Some code cleanup
This commit is contained in:
parent
facb01a7c2
commit
1c955e56fe
4 changed files with 6 additions and 22 deletions
|
@ -350,21 +350,9 @@ pub use {
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
/// `true` if egui was compiled with debug assertions enabled.
|
|
||||||
#[cfg(debug_assertions)]
|
|
||||||
pub(crate) const fn has_debug_assertions() -> bool {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
|
|
||||||
/// `true` if egui was compiled with debug assertions enabled.
|
|
||||||
#[cfg(not(debug_assertions))]
|
|
||||||
pub(crate) const fn has_debug_assertions() -> bool {
|
|
||||||
false
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Helper function that adds a label when compiling with debug assertions enabled.
|
/// Helper function that adds a label when compiling with debug assertions enabled.
|
||||||
pub fn warn_if_debug_build(ui: &mut crate::Ui) {
|
pub fn warn_if_debug_build(ui: &mut crate::Ui) {
|
||||||
if crate::has_debug_assertions() {
|
if cfg!(debug_assertions) {
|
||||||
ui.label(
|
ui.label(
|
||||||
crate::Label::new("‼ Debug build ‼")
|
crate::Label::new("‼ Debug build ‼")
|
||||||
.small()
|
.small()
|
||||||
|
|
|
@ -205,7 +205,7 @@ impl WidgetGallery {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn example_plot() -> egui::plot::Plot {
|
fn example_plot() -> egui::plot::Plot {
|
||||||
let n = 512;
|
let n = 128;
|
||||||
let curve = egui::plot::Curve::from_values_iter((0..=n).map(|i| {
|
let curve = egui::plot::Curve::from_values_iter((0..=n).map(|i| {
|
||||||
use std::f64::consts::TAU;
|
use std::f64::consts::TAU;
|
||||||
let x = egui::remap(i as f64, 0.0..=(n as f64), -TAU..=TAU);
|
let x = egui::remap(i as f64, 0.0..=(n as f64), -TAU..=TAU);
|
||||||
|
|
|
@ -64,14 +64,7 @@ impl epi::App for WrapApp {
|
||||||
|
|
||||||
fn warm_up_enabled(&self) -> bool {
|
fn warm_up_enabled(&self) -> bool {
|
||||||
// The example windows use a lot of emojis. Pre-cache them by running one frame where everything is open
|
// The example windows use a lot of emojis. Pre-cache them by running one frame where everything is open
|
||||||
#[cfg(debug_assertions)]
|
cfg!(not(debug_assertions))
|
||||||
{
|
|
||||||
false // debug
|
|
||||||
}
|
|
||||||
#[cfg(not(debug_assertions))]
|
|
||||||
{
|
|
||||||
true // release
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn update(&mut self, ctx: &egui::CtxRef, frame: &mut epi::Frame<'_>) {
|
fn update(&mut self, ctx: &egui::CtxRef, frame: &mut epi::Frame<'_>) {
|
||||||
|
|
|
@ -246,6 +246,9 @@ pub struct IntegrationInfo {
|
||||||
/// How to allocate textures (images) to use in [`egui`].
|
/// How to allocate textures (images) to use in [`egui`].
|
||||||
pub trait TextureAllocator {
|
pub trait TextureAllocator {
|
||||||
/// Allocate a new user texture.
|
/// Allocate a new user texture.
|
||||||
|
///
|
||||||
|
/// There is no way to change a texture.
|
||||||
|
/// Instead allocate a new texture and free the previous one with [`Self::free`].
|
||||||
fn alloc_srgba_premultiplied(
|
fn alloc_srgba_premultiplied(
|
||||||
&mut self,
|
&mut self,
|
||||||
size: (usize, usize),
|
size: (usize, usize),
|
||||||
|
|
Loading…
Reference in a new issue