Skip to content

Commit

Permalink
Correct the overflow/underflow of Brightness xLightsSequencer#5195
Browse files Browse the repository at this point in the history
  • Loading branch information
derwin12 committed Feb 19, 2025
1 parent 1beca45 commit ea45dfd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xLights/effects/ispc/LayerBlendingFunctions.ispc
Original file line number Diff line number Diff line change
Expand Up @@ -820,9 +820,9 @@ export void AsBrightnessFunction(uniform const LayerBlendingData &data,
if (!data.isChromaKey || !applyChroma(data, fg)) {
uint32 bg = result[index];
float alpha = (float)alpha(fg) / 255.0;
int r = div_255_fast(red(fg) * red(bg) * alpha);
int g = div_255_fast(green(fg) * green(bg) * alpha);
int b = div_255_fast(blue(fg) * blue(bg) * alpha);
int r = div_255_fast((int)red(fg) * (int)red(bg) * alpha);
int g = div_255_fast((int)green(fg) * (int)green(bg) * alpha);
int b = div_255_fast((int)blue(fg) * (int)blue(bg) * alpha);
result[index] = fromComponents((uint8)r, (uint8)g, (uint8)b, 255);
}
}
Expand Down

0 comments on commit ea45dfd

Please sign in to comment.