mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 13:20:05 -04:00
Remove extra_asserts and extra_debug_asserts feature flags (#4478)
Removes `egui_assert` etc and replaces it with normal `debug_assert` calls. Previously you could opt-in to more runtime checks using feature flags. Now these extra runtime checks are always enabled for debug builds. You are most likely to encounter them if you use negative sizes or NaNs or other similar bugs. These usually indicate bugs in user space.
This commit is contained in:
@@ -109,7 +109,7 @@ impl Mesh {
|
||||
/// Append all the indices and vertices of `other` to `self`.
|
||||
pub fn append(&mut self, other: Self) {
|
||||
crate::profile_function!();
|
||||
crate::epaint_assert!(other.is_valid());
|
||||
debug_assert!(other.is_valid());
|
||||
|
||||
if self.is_empty() {
|
||||
*self = other;
|
||||
@@ -121,7 +121,7 @@ impl Mesh {
|
||||
/// Append all the indices and vertices of `other` to `self` without
|
||||
/// taking ownership.
|
||||
pub fn append_ref(&mut self, other: &Self) {
|
||||
crate::epaint_assert!(other.is_valid());
|
||||
debug_assert!(other.is_valid());
|
||||
|
||||
if self.is_empty() {
|
||||
self.texture_id = other.texture_id;
|
||||
@@ -140,7 +140,7 @@ impl Mesh {
|
||||
|
||||
#[inline(always)]
|
||||
pub fn colored_vertex(&mut self, pos: Pos2, color: Color32) {
|
||||
crate::epaint_assert!(self.texture_id == TextureId::default());
|
||||
debug_assert!(self.texture_id == TextureId::default());
|
||||
self.vertices.push(Vertex {
|
||||
pos,
|
||||
uv: WHITE_UV,
|
||||
@@ -203,7 +203,7 @@ impl Mesh {
|
||||
/// Uniformly colored rectangle.
|
||||
#[inline(always)]
|
||||
pub fn add_colored_rect(&mut self, rect: Rect, color: Color32) {
|
||||
crate::epaint_assert!(self.texture_id == TextureId::default());
|
||||
debug_assert!(self.texture_id == TextureId::default());
|
||||
self.add_rect_with_uv(rect, [WHITE_UV, WHITE_UV].into(), color);
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ impl Mesh {
|
||||
/// Splits this mesh into many smaller meshes (if needed)
|
||||
/// where the smaller meshes have 16-bit indices.
|
||||
pub fn split_to_u16(self) -> Vec<Mesh16> {
|
||||
crate::epaint_assert!(self.is_valid());
|
||||
debug_assert!(self.is_valid());
|
||||
|
||||
const MAX_SIZE: u32 = std::u16::MAX as u32;
|
||||
|
||||
@@ -265,7 +265,7 @@ impl Mesh {
|
||||
vertices: self.vertices[(min_vindex as usize)..=(max_vindex as usize)].to_vec(),
|
||||
texture_id: self.texture_id,
|
||||
};
|
||||
crate::epaint_assert!(mesh.is_valid());
|
||||
debug_assert!(mesh.is_valid());
|
||||
output.push(mesh);
|
||||
}
|
||||
output
|
||||
|
||||
Reference in New Issue
Block a user