mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Fixed an issue where horizontal and vertical color gradients were mixed up.
Also added logging in case an invalid gradient type is used in a theme.
This commit is contained in:
parent
9a24423c82
commit
89efdef39c
|
@ -343,8 +343,22 @@ void CarouselComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
if (elem->has("colorEnd"))
|
||||
mCarouselColorEnd = elem->get<unsigned int>("colorEnd");
|
||||
if (elem->has("gradientType"))
|
||||
mColorGradientHorizontal = (elem->get<std::string>("gradientType") == "horizontal");
|
||||
|
||||
if (elem->has("gradientType")) {
|
||||
const std::string gradientType {elem->get<std::string>("gradientType")};
|
||||
if (gradientType == "horizontal") {
|
||||
mColorGradientHorizontal = true;
|
||||
}
|
||||
else if (gradientType == "vertical") {
|
||||
mColorGradientHorizontal = false;
|
||||
}
|
||||
else {
|
||||
mColorGradientHorizontal = true;
|
||||
LOG(LogWarning) << "CarouselComponent: Invalid theme configuration, property "
|
||||
"<gradientType> set to \""
|
||||
<< gradientType << "\"";
|
||||
}
|
||||
}
|
||||
|
||||
if (elem->has("logoScale"))
|
||||
mLogoScale = glm::clamp(elem->get<float>("logoScale"), 0.5f, 3.0f);
|
||||
|
|
|
@ -377,8 +377,8 @@ void ImageComponent::updateColors()
|
|||
static_cast<unsigned char>((mColorShiftEnd & 0xFF) * opacity));
|
||||
|
||||
mVertices[0].col = color;
|
||||
mVertices[1].col = mColorGradientHorizontal ? colorEnd : color;
|
||||
mVertices[2].col = mColorGradientHorizontal ? color : colorEnd;
|
||||
mVertices[1].col = mColorGradientHorizontal ? color : colorEnd;
|
||||
mVertices[2].col = mColorGradientHorizontal ? colorEnd : color;
|
||||
mVertices[3].col = colorEnd;
|
||||
}
|
||||
|
||||
|
@ -513,9 +513,21 @@ void ImageComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
setColorShift(elem->get<unsigned int>("color"));
|
||||
if (elem->has("colorEnd"))
|
||||
setColorShiftEnd(elem->get<unsigned int>("colorEnd"));
|
||||
if (elem->has("gradientType"))
|
||||
setColorGradientHorizontal(
|
||||
!(elem->get<std::string>("gradientType").compare("horizontal")));
|
||||
if (elem->has("gradientType")) {
|
||||
const std::string gradientType {elem->get<std::string>("gradientType")};
|
||||
if (gradientType == "horizontal") {
|
||||
setColorGradientHorizontal(true);
|
||||
}
|
||||
else if (gradientType == "vertical") {
|
||||
setColorGradientHorizontal(false);
|
||||
}
|
||||
else {
|
||||
setColorGradientHorizontal(true);
|
||||
LOG(LogWarning) << "ImageComponent: Invalid theme configuration, property "
|
||||
"<gradientType> set to \""
|
||||
<< gradientType << "\"";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (elem->has("scrollFadeIn") && elem->get<bool>("scrollFadeIn"))
|
||||
|
|
|
@ -474,9 +474,21 @@ void TextListComponent<T>::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
if (elem->has("selectorColorEnd"))
|
||||
setSelectorColorEnd(elem->get<unsigned int>("selectorColorEnd"));
|
||||
if (elem->has("selectorGradientType"))
|
||||
setSelectorColorGradientHorizontal(
|
||||
!(elem->get<std::string>("selectorGradientType").compare("horizontal")));
|
||||
if (elem->has("selectorGradientType")) {
|
||||
const std::string gradientType {elem->get<std::string>("selectorGradientType")};
|
||||
if (gradientType == "horizontal") {
|
||||
setSelectorColorGradientHorizontal(true);
|
||||
}
|
||||
else if (gradientType == "vertical") {
|
||||
setSelectorColorGradientHorizontal(false);
|
||||
}
|
||||
else {
|
||||
setSelectorColorGradientHorizontal(true);
|
||||
LOG(LogWarning) << "TextListComponent: Invalid theme configuration, property "
|
||||
"<selectorGradientType> set to \""
|
||||
<< gradientType << "\"";
|
||||
}
|
||||
}
|
||||
if (elem->has("selectedColor"))
|
||||
setSelectedColor(elem->get<unsigned int>("selectedColor"));
|
||||
if (elem->has("primaryColor"))
|
||||
|
|
|
@ -477,8 +477,8 @@ namespace Renderer
|
|||
|
||||
// clang-format off
|
||||
vertices[0] = {{x, y }, {0.0f, 0.0f}, rColor};
|
||||
vertices[1] = {{x, y + hL}, {0.0f, 0.0f}, horizontalGradient ? rColorEnd : rColor};
|
||||
vertices[2] = {{x + wL, y }, {0.0f, 0.0f}, horizontalGradient ? rColor : rColorEnd};
|
||||
vertices[1] = {{x, y + hL}, {0.0f, 0.0f}, horizontalGradient ? rColor : rColorEnd};
|
||||
vertices[2] = {{x + wL, y }, {0.0f, 0.0f}, horizontalGradient ? rColorEnd : rColor};
|
||||
vertices[3] = {{x + wL, y + hL}, {0.0f, 0.0f}, rColorEnd};
|
||||
// clang-format on
|
||||
|
||||
|
|
Loading…
Reference in a new issue