Clippy fixes

This commit is contained in:
Imbris 2022-11-14 22:43:21 -05:00
parent 132ce72246
commit 2a9a63a60e
4 changed files with 7 additions and 11 deletions

View File

@ -180,10 +180,6 @@ void main() {
// worry about bleeding in the atlas and/or what the border behavior
// should be.
// TODO: benchmark before and after by viewing zoomed out map in the UI
// (at particular ui scale and map zoom out, far enough to trigger downscaling)
// (seems like ~10% increase if any)
// Convert to sampled pixel coordinates.
vec2 uv_pixel = f_uv * texture_size;
vec4 image_color;

View File

@ -4,8 +4,6 @@ use core::num::NonZeroU32;
use std::mem;
use vek::*;
// TODO: profile UI rendering before and after on laptop.
/// The format of textures that the UI sources image data from.
///
/// Note, the is not directly used in all relevant locations, but still helps to

View File

@ -440,7 +440,7 @@ impl<'frame> Drawer<'frame> {
/// Runs render passes with alpha premultiplication pipeline to complete any
/// pending uploads.
fn run_ui_premultiply_passes<'a>(&mut self) {
fn run_ui_premultiply_passes(&mut self) {
prof_span!("run_ui_premultiply_passes");
let Some(premultiply_alpha) = self.borrow.pipelines.premultiply_alpha() else { return };
let encoder = self.encoder.as_mut().unwrap();

View File

@ -214,6 +214,7 @@ impl TextureRequirements {
}
}
#[allow(clippy::wrong_self_convention)] // type is spiritually Copy
fn to_key_and_tex_parameters(
self,
graphic_id: Id,
@ -304,7 +305,7 @@ impl GraphicCache {
};
let old_requirements = TextureRequirements::from_graphic(&old);
let new_requirements = TextureRequirements::from_graphic(&new);
let new_requirements = TextureRequirements::from_graphic(new);
let should_invalidate = old_requirements == new_requirements && old_requirements.is_some();
// Invalidate if possible or remove from caches.
@ -468,7 +469,7 @@ impl GraphicCache {
},
};
let requirements = TextureRequirements::from_graphic(&graphic)?;
let requirements = TextureRequirements::from_graphic(graphic)?;
let (key, texture_parameters) =
requirements.to_key_and_tex_parameters(graphic_id, requested_dims_upright);
@ -642,7 +643,7 @@ fn prepare_graphic<'graphic>(
// expensive enough to do in the background we would just do it on
// the GPU. Could still use `rayon` to parallelize this work, if
// needed.
let premultiply_strategy = PremultiplyStrategy::determine(&*rgba_cow);
let premultiply_strategy = PremultiplyStrategy::determine(&rgba_cow);
let needs_gpu_premultiply = match premultiply_strategy {
PremultiplyStrategy::UseGpu => true,
PremultiplyStrategy::NotNeeded => false,
@ -767,7 +768,7 @@ fn upload_image(
let size = aabr.size().into_array();
// upload directly
renderer.update_texture(
&*target_texture,
target_texture,
offset,
size,
// NOTE: Rgba texture, so each pixel is 4 bytes, ergo this cannot fail.
@ -1044,6 +1045,7 @@ impl PremultiplyStrategy {
/// Computes the fraction of 4 pixel chunks that are fully translucent or
/// opaque. Returns `None` if no premultiplication is needed (i.e. all alpha
/// values are 255).
#[allow(clippy::unusual_byte_groupings)]
fn fraction_shortcircuit_blocks(image: &RgbaImage) -> Option<f32> {
let dims = image.dimensions();
let pixel_count = dims.0 as usize * dims.1 as usize;