ImBuf: Change rounding for byte buffer in IMB_rectfill()

It matches the behavior of IMB_rectfill_area() with opaque alpha now.

This is important as the function is used in baking, where the neutral
0.5 is expected to be mapped to 128.
This commit is contained in:
Sergey Sharybin
2025-08-22 17:08:25 +02:00
parent c9a87558d4
commit a56922099e

View File

@@ -982,12 +982,9 @@ void IMB_rectfill(ImBuf *drect, const float col[4])
if (drect->byte_buffer.data) {
uint *rrect = (uint *)drect->byte_buffer.data;
char ccol[4];
ccol[0] = int(col[0] * 255);
ccol[1] = int(col[1] * 255);
ccol[2] = int(col[2] * 255);
ccol[3] = int(col[3] * 255);
char ccol[4];
unit_float_to_uchar_clamp_v4(ccol, col);
num = IMB_get_pixel_count(drect);
for (; num > 0; num--) {