Round gradient colors.

This commit is contained in:
Hei 2025-07-27 03:41:34 +03:00
parent 0dd9178269
commit f6602d40bd

View file

@ -120,10 +120,10 @@ void GradientTexture1D::_update() const {
float ofs = float(i) / (width - 1);
Color color = g.get_color_at_offset(ofs);
wd8[i * 4 + 0] = uint8_t(CLAMP(color.r * 255.0, 0, 255));
wd8[i * 4 + 1] = uint8_t(CLAMP(color.g * 255.0, 0, 255));
wd8[i * 4 + 2] = uint8_t(CLAMP(color.b * 255.0, 0, 255));
wd8[i * 4 + 3] = uint8_t(CLAMP(color.a * 255.0, 0, 255));
wd8[i * 4 + 0] = uint8_t(color.get_r8());
wd8[i * 4 + 1] = uint8_t(color.get_g8());
wd8[i * 4 + 2] = uint8_t(color.get_b8());
wd8[i * 4 + 3] = uint8_t(color.get_a8());
}
}
@ -259,10 +259,10 @@ void GradientTexture2D::_update() const {
float ofs = _get_gradient_offset_at(x, y);
const Color &c = g.get_color_at_offset(ofs);
wd8[(x + (y * width)) * 4 + 0] = uint8_t(CLAMP(c.r * 255.0, 0, 255));
wd8[(x + (y * width)) * 4 + 1] = uint8_t(CLAMP(c.g * 255.0, 0, 255));
wd8[(x + (y * width)) * 4 + 2] = uint8_t(CLAMP(c.b * 255.0, 0, 255));
wd8[(x + (y * width)) * 4 + 3] = uint8_t(CLAMP(c.a * 255.0, 0, 255));
wd8[(x + (y * width)) * 4 + 0] = uint8_t(c.get_r8());
wd8[(x + (y * width)) * 4 + 1] = uint8_t(c.get_g8());
wd8[(x + (y * width)) * 4 + 2] = uint8_t(c.get_b8());
wd8[(x + (y * width)) * 4 + 3] = uint8_t(c.get_a8());
}
}
}