Skip to content

Commit f6602d4

Browse files
committed
Round gradient colors.
1 parent 0dd9178 commit f6602d4

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

scene/resources/gradient_texture.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,10 @@ void GradientTexture1D::_update() const {
120120
float ofs = float(i) / (width - 1);
121121
Color color = g.get_color_at_offset(ofs);
122122

123-
wd8[i * 4 + 0] = uint8_t(CLAMP(color.r * 255.0, 0, 255));
124-
wd8[i * 4 + 1] = uint8_t(CLAMP(color.g * 255.0, 0, 255));
125-
wd8[i * 4 + 2] = uint8_t(CLAMP(color.b * 255.0, 0, 255));
126-
wd8[i * 4 + 3] = uint8_t(CLAMP(color.a * 255.0, 0, 255));
123+
wd8[i * 4 + 0] = uint8_t(color.get_r8());
124+
wd8[i * 4 + 1] = uint8_t(color.get_g8());
125+
wd8[i * 4 + 2] = uint8_t(color.get_b8());
126+
wd8[i * 4 + 3] = uint8_t(color.get_a8());
127127
}
128128
}
129129

@@ -259,10 +259,10 @@ void GradientTexture2D::_update() const {
259259
float ofs = _get_gradient_offset_at(x, y);
260260
const Color &c = g.get_color_at_offset(ofs);
261261

262-
wd8[(x + (y * width)) * 4 + 0] = uint8_t(CLAMP(c.r * 255.0, 0, 255));
263-
wd8[(x + (y * width)) * 4 + 1] = uint8_t(CLAMP(c.g * 255.0, 0, 255));
264-
wd8[(x + (y * width)) * 4 + 2] = uint8_t(CLAMP(c.b * 255.0, 0, 255));
265-
wd8[(x + (y * width)) * 4 + 3] = uint8_t(CLAMP(c.a * 255.0, 0, 255));
262+
wd8[(x + (y * width)) * 4 + 0] = uint8_t(c.get_r8());
263+
wd8[(x + (y * width)) * 4 + 1] = uint8_t(c.get_g8());
264+
wd8[(x + (y * width)) * 4 + 2] = uint8_t(c.get_b8());
265+
wd8[(x + (y * width)) * 4 + 3] = uint8_t(c.get_a8());
266266
}
267267
}
268268
}

0 commit comments

Comments
 (0)