Skip to content

Commit ad83e7f

Browse files
committed
graster-nodes: change Table<Color> params to Color where only one value is used
1 parent 3a49a47 commit ad83e7f

File tree

2 files changed

+3
-15
lines changed

2 files changed

+3
-15
lines changed

node-graph/graster-nodes/src/adjustments.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ fn black_and_white<T: Adjust<Color>>(
307307
GradientStops,
308308
)]
309309
mut image: T,
310-
#[default(Color::BLACK)] tint: Table<Color>,
310+
#[default(Color::BLACK)] tint: Color,
311311
#[default(40.)]
312312
#[range((-200., 300.))]
313313
reds: PercentageF32,
@@ -327,9 +327,6 @@ fn black_and_white<T: Adjust<Color>>(
327327
#[range((-200., 300.))]
328328
magentas: PercentageF32,
329329
) -> T {
330-
let tint: Option<Color> = tint.into();
331-
let tint = tint.unwrap_or(Color::BLACK);
332-
333330
image.adjust(|color| {
334331
let color = color.to_gamma_srgb();
335332

node-graph/graster-nodes/src/blending_nodes.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -166,15 +166,12 @@ fn color_overlay<T: Adjust<Color>>(
166166
GradientStops,
167167
)]
168168
mut image: T,
169-
#[default(Color::BLACK)] color: Table<Color>,
169+
#[default(Color::BLACK)] color: Color,
170170
blend_mode: BlendMode,
171171
#[default(100.)] opacity: PercentageF32,
172172
) -> T {
173173
let opacity = (opacity as f32 / 100.).clamp(0., 1.);
174174

175-
let color: Option<Color> = color.into();
176-
let color = color.unwrap_or(Color::BLACK);
177-
178175
image.adjust(|pixel| {
179176
let image = pixel.map_rgb(|channel| channel * (1. - opacity));
180177

@@ -206,13 +203,7 @@ mod test {
206203
// 100% of the output should come from the multiplied value
207204
let opacity = 100.;
208205

209-
let result = super::color_overlay(
210-
(),
211-
Table::new_from_element(Raster::new_cpu(image.clone())),
212-
Table::new_from_element(overlay_color),
213-
BlendMode::Multiply,
214-
opacity,
215-
);
206+
let result = super::color_overlay((), Table::new_from_element(Raster::new_cpu(image.clone())), overlay_color, BlendMode::Multiply, opacity);
216207
let result = result.iter().next().unwrap().element;
217208

218209
// The output should just be the original green and alpha channels (as we multiply them by 1 and other channels by 0)

0 commit comments

Comments
 (0)