Fix clippy 1.50 lints
This commit is contained in:
parent
fc8b27807c
commit
5906bf7a87
3 changed files with 35 additions and 41 deletions
|
@ -286,18 +286,16 @@ impl Painter {
|
||||||
assert_eq!(size.0 * size.1, pixels.len());
|
assert_eq!(size.0 * size.1, pixels.len());
|
||||||
|
|
||||||
if let egui::TextureId::User(id) = id {
|
if let egui::TextureId::User(id) = id {
|
||||||
if let Some(user_texture) = self.user_textures.get_mut(id as usize) {
|
if let Some(Some(user_texture)) = self.user_textures.get_mut(id as usize) {
|
||||||
if let Some(user_texture) = user_texture {
|
let pixels: Vec<Vec<(u8, u8, u8, u8)>> = pixels
|
||||||
let pixels: Vec<Vec<(u8, u8, u8, u8)>> = pixels
|
.chunks(size.0 as usize)
|
||||||
.chunks(size.0 as usize)
|
.map(|row| row.iter().map(|srgba| srgba.to_tuple()).collect())
|
||||||
.map(|row| row.iter().map(|srgba| srgba.to_tuple()).collect())
|
.collect();
|
||||||
.collect();
|
|
||||||
|
|
||||||
*user_texture = UserTexture {
|
*user_texture = UserTexture {
|
||||||
pixels,
|
pixels,
|
||||||
gl_texture: None,
|
gl_texture: None,
|
||||||
};
|
};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -181,22 +181,20 @@ impl WebGlPainter {
|
||||||
let index = self.alloc_user_texture_index();
|
let index = self.alloc_user_texture_index();
|
||||||
assert_eq!(size.0 * size.1, srgba_pixels.len());
|
assert_eq!(size.0 * size.1, srgba_pixels.len());
|
||||||
|
|
||||||
if let Some(user_texture) = self.user_textures.get_mut(index) {
|
if let Some(Some(user_texture)) = self.user_textures.get_mut(index) {
|
||||||
if let Some(user_texture) = user_texture {
|
let mut pixels: Vec<u8> = Vec::with_capacity(srgba_pixels.len() * 4);
|
||||||
let mut pixels: Vec<u8> = Vec::with_capacity(srgba_pixels.len() * 4);
|
for srgba in srgba_pixels {
|
||||||
for srgba in srgba_pixels {
|
pixels.push(srgba.r());
|
||||||
pixels.push(srgba.r());
|
pixels.push(srgba.g());
|
||||||
pixels.push(srgba.g());
|
pixels.push(srgba.b());
|
||||||
pixels.push(srgba.b());
|
pixels.push(srgba.a());
|
||||||
pixels.push(srgba.a());
|
|
||||||
}
|
|
||||||
|
|
||||||
*user_texture = UserTexture {
|
|
||||||
size,
|
|
||||||
pixels,
|
|
||||||
gl_texture: None,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*user_texture = UserTexture {
|
||||||
|
size,
|
||||||
|
pixels,
|
||||||
|
gl_texture: None,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
egui::TextureId::User(index as u64)
|
egui::TextureId::User(index as u64)
|
||||||
|
|
|
@ -171,22 +171,20 @@ impl WebGl2Painter {
|
||||||
let index = self.alloc_user_texture_index();
|
let index = self.alloc_user_texture_index();
|
||||||
assert_eq!(size.0 * size.1, srgba_pixels.len());
|
assert_eq!(size.0 * size.1, srgba_pixels.len());
|
||||||
|
|
||||||
if let Some(user_texture) = self.user_textures.get_mut(index) {
|
if let Some(Some(user_texture)) = self.user_textures.get_mut(index) {
|
||||||
if let Some(user_texture) = user_texture {
|
let mut pixels: Vec<u8> = Vec::with_capacity(srgba_pixels.len() * 4);
|
||||||
let mut pixels: Vec<u8> = Vec::with_capacity(srgba_pixels.len() * 4);
|
for srgba in srgba_pixels {
|
||||||
for srgba in srgba_pixels {
|
pixels.push(srgba.r());
|
||||||
pixels.push(srgba.r());
|
pixels.push(srgba.g());
|
||||||
pixels.push(srgba.g());
|
pixels.push(srgba.b());
|
||||||
pixels.push(srgba.b());
|
pixels.push(srgba.a());
|
||||||
pixels.push(srgba.a());
|
|
||||||
}
|
|
||||||
|
|
||||||
*user_texture = UserTexture {
|
|
||||||
size,
|
|
||||||
pixels,
|
|
||||||
gl_texture: None,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*user_texture = UserTexture {
|
||||||
|
size,
|
||||||
|
pixels,
|
||||||
|
gl_texture: None,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
egui::TextureId::User(index as u64)
|
egui::TextureId::User(index as u64)
|
||||||
|
|
Loading…
Reference in a new issue