1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-29 04:40:03 -04:00

Replace Stroke::none() with Stroke::NONE

This commit is contained in:
Emil Ernerfeldt
2022-12-05 12:59:02 +01:00
parent df01db2df1
commit be6d23eed1
15 changed files with 30 additions and 28 deletions

View File

@@ -648,7 +648,7 @@ impl TextShape {
Self {
pos,
galley,
underline: Stroke::none(),
underline: Stroke::NONE,
override_text_color: None,
angle: 0.0,
}

View File

@@ -14,6 +14,12 @@ pub struct Stroke {
impl Stroke {
/// Same as [`Stroke::default`].
pub const NONE: Stroke = Stroke {
width: 0.0,
color: Color32::TRANSPARENT,
};
#[deprecated = "Use Stroke::NONE instead"]
#[inline(always)]
pub fn none() -> Self {
Self::new(0.0, Color32::TRANSPARENT)

View File

@@ -1412,7 +1412,7 @@ impl Tessellator {
}),
);
if *underline != Stroke::none() {
if *underline != Stroke::NONE {
self.scratchpad_path.clear();
self.scratchpad_path
.add_line_segment([row_rect.left_bottom(), row_rect.right_bottom()]);

View File

@@ -493,8 +493,8 @@ fn format_summary(job: &LayoutJob) -> FormatSummary {
let mut format_summary = FormatSummary::default();
for section in &job.sections {
format_summary.any_background |= section.format.background != Color32::TRANSPARENT;
format_summary.any_underline |= section.format.underline != Stroke::none();
format_summary.any_strikethrough |= section.format.strikethrough != Stroke::none();
format_summary.any_underline |= section.format.underline != Stroke::NONE;
format_summary.any_strikethrough |= section.format.strikethrough != Stroke::NONE;
}
format_summary
}
@@ -665,7 +665,7 @@ fn add_row_hline(
for glyph in &row.glyphs {
let (stroke, y) = stroke_and_y(glyph);
if stroke == Stroke::none() {
if stroke == Stroke::NONE {
end_line(line_start.take(), last_right_x);
} else if let Some((existing_stroke, start)) = line_start {
if existing_stroke == stroke && start.y == y {

View File

@@ -238,8 +238,8 @@ impl Default for TextFormat {
color: Color32::GRAY,
background: Color32::TRANSPARENT,
italics: false,
underline: Stroke::none(),
strikethrough: Stroke::none(),
underline: Stroke::NONE,
strikethrough: Stroke::NONE,
valign: Align::BOTTOM,
}
}