Run cargo fmt

This commit is contained in:
Héctor Ramón Jiménez 2022-11-03 04:35:16 +01:00
parent 20a0577034
commit b957453404
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
17 changed files with 95 additions and 107 deletions

View file

@ -1,6 +1,6 @@
use crate::{program, triangle};
use crate::quad;
use crate::text;
use crate::{program, triangle};
use crate::{Settings, Transformation, Viewport};
use iced_graphics::backend;

View file

@ -57,52 +57,55 @@ impl Program {
if &self.uniform_data.gradient != gradient {
match gradient {
Gradient::Linear(linear) => {
unsafe {
gl.uniform_4_f32(
Some(
&self.uniform_data.uniform_locations.gradient_direction_location
),
linear.start.x,
linear.start.y,
linear.end.x,
linear.end.y
);
Gradient::Linear(linear) => unsafe {
gl.uniform_4_f32(
Some(
&self
.uniform_data
.uniform_locations
.gradient_direction_location,
),
linear.start.x,
linear.start.y,
linear.end.x,
linear.end.y,
);
gl.uniform_1_u32(
Some(
&self
.uniform_data
.uniform_locations
.color_stops_size_location,
),
(linear.color_stops.len() * 2) as u32,
);
gl.uniform_1_u32(
Some(
&self
.uniform_data
.uniform_locations
.color_stops_size_location,
),
(linear.color_stops.len() * 2) as u32,
);
let mut stops = [0.0; 128];
let mut stops = [0.0; 128];
for (index, stop) in linear.color_stops.iter().enumerate().take(16) {
stops[index*8] = stop.color.r;
stops[(index*8)+1] = stop.color.g;
stops[(index*8)+2] = stop.color.b;
stops[(index*8)+3] = stop.color.a;
stops[(index*8)+4] = stop.offset;
stops[(index*8)+5] = 0.;
stops[(index*8)+6] = 0.;
stops[(index*8)+7] = 0.;
}
gl.uniform_4_f32_slice(
Some(
&self
.uniform_data
.uniform_locations
.color_stops_location,
),
&stops,
);
for (index, stop) in
linear.color_stops.iter().enumerate().take(16)
{
stops[index * 8] = stop.color.r;
stops[(index * 8) + 1] = stop.color.g;
stops[(index * 8) + 2] = stop.color.b;
stops[(index * 8) + 3] = stop.color.a;
stops[(index * 8) + 4] = stop.offset;
stops[(index * 8) + 5] = 0.;
stops[(index * 8) + 6] = 0.;
stops[(index * 8) + 7] = 0.;
}
}
gl.uniform_4_f32_slice(
Some(
&self
.uniform_data
.uniform_locations
.color_stops_location,
),
&stops,
);
},
}
self.uniform_data.gradient = gradient.clone();

View file

@ -26,7 +26,11 @@ impl<Theme> iced_graphics::window::GLCompositor for Compositor<Theme> {
log::info!("{:#?}", settings);
let version = gl.version();
log::info!("OpenGL version: {:?} (Embedded: {})", version, version.is_embedded);
log::info!(
"OpenGL version: {:?} (Embedded: {})",
version,
version.is_embedded
);
let renderer = gl.get_parameter_string(glow::RENDERER);
log::info!("Renderer: {}", renderer);