Merge pull request #109012 from Lielay9/fix_gradient_color
Round gradient colors
This commit is contained in:
@ -120,10 +120,10 @@ void GradientTexture1D::_update() const {
|
|||||||
float ofs = float(i) / (width - 1);
|
float ofs = float(i) / (width - 1);
|
||||||
Color color = g.get_color_at_offset(ofs);
|
Color color = g.get_color_at_offset(ofs);
|
||||||
|
|
||||||
wd8[i * 4 + 0] = uint8_t(CLAMP(color.r * 255.0, 0, 255));
|
wd8[i * 4 + 0] = uint8_t(color.get_r8());
|
||||||
wd8[i * 4 + 1] = uint8_t(CLAMP(color.g * 255.0, 0, 255));
|
wd8[i * 4 + 1] = uint8_t(color.get_g8());
|
||||||
wd8[i * 4 + 2] = uint8_t(CLAMP(color.b * 255.0, 0, 255));
|
wd8[i * 4 + 2] = uint8_t(color.get_b8());
|
||||||
wd8[i * 4 + 3] = uint8_t(CLAMP(color.a * 255.0, 0, 255));
|
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);
|
float ofs = _get_gradient_offset_at(x, y);
|
||||||
const Color &c = g.get_color_at_offset(ofs);
|
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 + 0] = uint8_t(c.get_r8());
|
||||||
wd8[(x + (y * width)) * 4 + 1] = uint8_t(CLAMP(c.g * 255.0, 0, 255));
|
wd8[(x + (y * width)) * 4 + 1] = uint8_t(c.get_g8());
|
||||||
wd8[(x + (y * width)) * 4 + 2] = uint8_t(CLAMP(c.b * 255.0, 0, 255));
|
wd8[(x + (y * width)) * 4 + 2] = uint8_t(c.get_b8());
|
||||||
wd8[(x + (y * width)) * 4 + 3] = uint8_t(CLAMP(c.a * 255.0, 0, 255));
|
wd8[(x + (y * width)) * 4 + 3] = uint8_t(c.get_a8());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user