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()); } } }