fix(exporters): saturating cast in draw_text
This commit is contained in:
@@ -208,7 +208,7 @@ fn draw_char(img: &mut RgbaImage, x: u32, y: u32, ch: char, scale: u32, color: [
|
|||||||
fn draw_text(img: &mut RgbaImage, x: u32, y: u32, text: &str, scale: u32, color: [u8; 4]) {
|
fn draw_text(img: &mut RgbaImage, x: u32, y: u32, text: &str, scale: u32, color: [u8; 4]) {
|
||||||
let char_w = 6 * scale;
|
let char_w = 6 * scale;
|
||||||
for (i, ch) in text.chars().enumerate() {
|
for (i, ch) in text.chars().enumerate() {
|
||||||
draw_char(img, x + i as u32 * char_w, y, ch, scale, color);
|
draw_char(img, x + (i as u32).saturating_mul(char_w), y, ch, scale, color);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user