mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 07:53:26 +00:00
Merge pull request #109012 from Lielay9/fix_gradient_color
Round gradient colors
This commit is contained in:
commit
999b94cc39
1 changed files with 8 additions and 8 deletions
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue