mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-22 06:05:38 +00:00
Changed default interpolation to linear on arbitrary rotation for the image, video, animation, badges and rating elements
This commit is contained in:
parent
3d58eccd87
commit
2d4886a4e1
|
@ -301,6 +301,14 @@ void BadgeComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
}
|
||||
}
|
||||
|
||||
// Enable linear interpolation by default if element is arbitrarily rotated.
|
||||
if (properties & ThemeFlags::ROTATION && elem->has("rotation")) {
|
||||
const float rotation {std::abs(elem->get<float>("rotation"))};
|
||||
if (rotation != 0.0f &&
|
||||
(std::round(rotation) != rotation || static_cast<int>(rotation) % 90 != 0))
|
||||
mLinearInterpolation = true;
|
||||
}
|
||||
|
||||
if (elem->has("interpolation")) {
|
||||
const std::string& interpolation {elem->get<std::string>("interpolation")};
|
||||
if (interpolation == "linear") {
|
||||
|
|
|
@ -373,9 +373,13 @@ void GIFAnimComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
mIterationCount *= 2;
|
||||
}
|
||||
|
||||
if (elem->has("cornerRadius"))
|
||||
mCornerRadius =
|
||||
glm::clamp(elem->get<float>("cornerRadius"), 0.0f, 0.5f) * mRenderer->getScreenWidth();
|
||||
// Enable linear interpolation by default if element is arbitrarily rotated.
|
||||
if (properties & ThemeFlags::ROTATION && elem->has("rotation")) {
|
||||
const float rotation {std::abs(elem->get<float>("rotation"))};
|
||||
if (rotation != 0.0f &&
|
||||
(std::round(rotation) != rotation || static_cast<int>(rotation) % 90 != 0))
|
||||
mTexture->setLinearMagnify(true);
|
||||
}
|
||||
|
||||
if (elem->has("interpolation")) {
|
||||
const std::string& interpolation {elem->get<std::string>("interpolation")};
|
||||
|
@ -386,13 +390,16 @@ void GIFAnimComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
mTexture->setLinearMagnify(false);
|
||||
}
|
||||
else {
|
||||
mTexture->setLinearMagnify(false);
|
||||
LOG(LogWarning) << "GIFAnimComponent: Invalid theme configuration, property "
|
||||
"\"interpolation\" for element \""
|
||||
<< element.substr(10) << "\" defined as \"" << interpolation << "\"";
|
||||
}
|
||||
}
|
||||
|
||||
if (elem->has("cornerRadius"))
|
||||
mCornerRadius =
|
||||
glm::clamp(elem->get<float>("cornerRadius"), 0.0f, 0.5f) * mRenderer->getScreenWidth();
|
||||
|
||||
if (properties & COLOR) {
|
||||
if (elem->has("color")) {
|
||||
mColorShift = elem->get<unsigned int>("color");
|
||||
|
|
|
@ -548,6 +548,14 @@ void ImageComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
<< element.substr(6) << "\" defined as \"" << stationary << "\"";
|
||||
}
|
||||
|
||||
// Enable linear interpolation by default if element is arbitrarily rotated.
|
||||
if (properties & ThemeFlags::ROTATION && elem->has("rotation")) {
|
||||
const float rotation {std::abs(elem->get<float>("rotation"))};
|
||||
if (rotation != 0.0f &&
|
||||
(std::round(rotation) != rotation || static_cast<int>(rotation) % 90 != 0))
|
||||
mLinearInterpolation = true;
|
||||
}
|
||||
|
||||
if (elem->has("interpolation")) {
|
||||
const std::string& interpolation {elem->get<std::string>("interpolation")};
|
||||
if (interpolation == "linear") {
|
||||
|
@ -557,7 +565,6 @@ void ImageComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
mLinearInterpolation = false;
|
||||
}
|
||||
else {
|
||||
mLinearInterpolation = false;
|
||||
LOG(LogWarning) << "ImageComponent: Invalid theme configuration, property "
|
||||
"\"interpolation\" for element \""
|
||||
<< element.substr(6) << "\" defined as \"" << interpolation << "\"";
|
||||
|
|
|
@ -343,6 +343,14 @@ void LottieAnimComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
mIterationCount *= 2;
|
||||
}
|
||||
|
||||
// Enable linear interpolation by default if element is arbitrarily rotated.
|
||||
if (properties & ThemeFlags::ROTATION && elem->has("rotation")) {
|
||||
const float rotation {std::abs(elem->get<float>("rotation"))};
|
||||
if (rotation != 0.0f &&
|
||||
(std::round(rotation) != rotation || static_cast<int>(rotation) % 90 != 0))
|
||||
mTexture->setLinearMagnify(true);
|
||||
}
|
||||
|
||||
if (elem->has("interpolation")) {
|
||||
const std::string& interpolation {elem->get<std::string>("interpolation")};
|
||||
if (interpolation == "linear") {
|
||||
|
@ -352,7 +360,6 @@ void LottieAnimComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
mTexture->setLinearMagnify(false);
|
||||
}
|
||||
else {
|
||||
mTexture->setLinearMagnify(false);
|
||||
LOG(LogWarning) << "LottieAnimComponent: Invalid theme configuration, property "
|
||||
"\"interpolation\" for element \""
|
||||
<< element.substr(10) << "\" defined as \"" << interpolation << "\"";
|
||||
|
|
|
@ -229,6 +229,14 @@ void RatingComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
|
||||
bool linearInterpolation {false};
|
||||
|
||||
// Enable linear interpolation by default if element is arbitrarily rotated.
|
||||
if (properties & ThemeFlags::ROTATION && elem->has("rotation")) {
|
||||
const float rotation {std::abs(elem->get<float>("rotation"))};
|
||||
if (rotation != 0.0f &&
|
||||
(std::round(rotation) != rotation || static_cast<int>(rotation) % 90 != 0))
|
||||
linearInterpolation = true;
|
||||
}
|
||||
|
||||
if (elem->has("interpolation")) {
|
||||
const std::string& interpolation {elem->get<std::string>("interpolation")};
|
||||
if (interpolation == "linear") {
|
||||
|
@ -238,8 +246,6 @@ void RatingComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
linearInterpolation = false;
|
||||
}
|
||||
else {
|
||||
linearInterpolation = false;
|
||||
|
||||
LOG(LogWarning)
|
||||
<< "RatingComponent: Invalid theme configuration, property \"interpolation\" "
|
||||
"for element \""
|
||||
|
|
|
@ -215,6 +215,16 @@ void VideoComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
mStaticImage.setRotation(mRotation);
|
||||
mStaticImage.setRotationOrigin(mRotationOrigin);
|
||||
|
||||
// Enable linear interpolation by default if element is arbitrarily rotated.
|
||||
if (properties & ThemeFlags::ROTATION && elem->has("rotation")) {
|
||||
const float rotation {std::abs(elem->get<float>("rotation"))};
|
||||
if (rotation != 0.0f &&
|
||||
(std::round(rotation) != rotation || static_cast<int>(rotation) % 90 != 0)) {
|
||||
mLinearInterpolation = true;
|
||||
mStaticImage.setLinearInterpolation(true);
|
||||
}
|
||||
}
|
||||
|
||||
if (elem->has("interpolation")) {
|
||||
const std::string& interpolation {elem->get<std::string>("interpolation")};
|
||||
if (interpolation == "linear") {
|
||||
|
@ -226,7 +236,6 @@ void VideoComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
|||
mStaticImage.setLinearInterpolation(false);
|
||||
}
|
||||
else {
|
||||
mStaticImage.setLinearInterpolation(false);
|
||||
LOG(LogWarning) << "VideoComponent: Invalid theme configuration, property "
|
||||
"\"interpolation\" for element \""
|
||||
<< element.substr(6) << "\" defined as \"" << interpolation << "\"";
|
||||
|
|
Loading…
Reference in a new issue