From f6602d40bd593051c6fe713506a208849048172a Mon Sep 17 00:00:00 2001 From: Hei <40064911+Lielay9@users.noreply.github.com> Date: Sun, 27 Jul 2025 03:41:34 +0300 Subject: [PATCH] Round gradient colors. --- scene/resources/gradient_texture.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scene/resources/gradient_texture.cpp b/scene/resources/gradient_texture.cpp index 07e7de0cef6..920b0927a88 100644 --- a/scene/resources/gradient_texture.cpp +++ b/scene/resources/gradient_texture.cpp @@ -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()); } } }