mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2024-11-25 15:45: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")) {
|
if (elem->has("interpolation")) {
|
||||||
const std::string& interpolation {elem->get<std::string>("interpolation")};
|
const std::string& interpolation {elem->get<std::string>("interpolation")};
|
||||||
if (interpolation == "linear") {
|
if (interpolation == "linear") {
|
||||||
|
|
|
@ -373,9 +373,13 @@ void GIFAnimComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
mIterationCount *= 2;
|
mIterationCount *= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elem->has("cornerRadius"))
|
// Enable linear interpolation by default if element is arbitrarily rotated.
|
||||||
mCornerRadius =
|
if (properties & ThemeFlags::ROTATION && elem->has("rotation")) {
|
||||||
glm::clamp(elem->get<float>("cornerRadius"), 0.0f, 0.5f) * mRenderer->getScreenWidth();
|
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")) {
|
if (elem->has("interpolation")) {
|
||||||
const std::string& interpolation {elem->get<std::string>("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);
|
mTexture->setLinearMagnify(false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mTexture->setLinearMagnify(false);
|
|
||||||
LOG(LogWarning) << "GIFAnimComponent: Invalid theme configuration, property "
|
LOG(LogWarning) << "GIFAnimComponent: Invalid theme configuration, property "
|
||||||
"\"interpolation\" for element \""
|
"\"interpolation\" for element \""
|
||||||
<< element.substr(10) << "\" defined as \"" << interpolation << "\"";
|
<< 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 (properties & COLOR) {
|
||||||
if (elem->has("color")) {
|
if (elem->has("color")) {
|
||||||
mColorShift = elem->get<unsigned int>("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 << "\"";
|
<< 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")) {
|
if (elem->has("interpolation")) {
|
||||||
const std::string& interpolation {elem->get<std::string>("interpolation")};
|
const std::string& interpolation {elem->get<std::string>("interpolation")};
|
||||||
if (interpolation == "linear") {
|
if (interpolation == "linear") {
|
||||||
|
@ -557,7 +565,6 @@ void ImageComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
mLinearInterpolation = false;
|
mLinearInterpolation = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mLinearInterpolation = false;
|
|
||||||
LOG(LogWarning) << "ImageComponent: Invalid theme configuration, property "
|
LOG(LogWarning) << "ImageComponent: Invalid theme configuration, property "
|
||||||
"\"interpolation\" for element \""
|
"\"interpolation\" for element \""
|
||||||
<< element.substr(6) << "\" defined as \"" << interpolation << "\"";
|
<< element.substr(6) << "\" defined as \"" << interpolation << "\"";
|
||||||
|
|
|
@ -343,6 +343,14 @@ void LottieAnimComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
mIterationCount *= 2;
|
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")) {
|
if (elem->has("interpolation")) {
|
||||||
const std::string& interpolation {elem->get<std::string>("interpolation")};
|
const std::string& interpolation {elem->get<std::string>("interpolation")};
|
||||||
if (interpolation == "linear") {
|
if (interpolation == "linear") {
|
||||||
|
@ -352,7 +360,6 @@ void LottieAnimComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
mTexture->setLinearMagnify(false);
|
mTexture->setLinearMagnify(false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mTexture->setLinearMagnify(false);
|
|
||||||
LOG(LogWarning) << "LottieAnimComponent: Invalid theme configuration, property "
|
LOG(LogWarning) << "LottieAnimComponent: Invalid theme configuration, property "
|
||||||
"\"interpolation\" for element \""
|
"\"interpolation\" for element \""
|
||||||
<< element.substr(10) << "\" defined as \"" << interpolation << "\"";
|
<< element.substr(10) << "\" defined as \"" << interpolation << "\"";
|
||||||
|
|
|
@ -229,6 +229,14 @@ void RatingComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
|
|
||||||
bool linearInterpolation {false};
|
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")) {
|
if (elem->has("interpolation")) {
|
||||||
const std::string& interpolation {elem->get<std::string>("interpolation")};
|
const std::string& interpolation {elem->get<std::string>("interpolation")};
|
||||||
if (interpolation == "linear") {
|
if (interpolation == "linear") {
|
||||||
|
@ -238,8 +246,6 @@ void RatingComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
linearInterpolation = false;
|
linearInterpolation = false;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
linearInterpolation = false;
|
|
||||||
|
|
||||||
LOG(LogWarning)
|
LOG(LogWarning)
|
||||||
<< "RatingComponent: Invalid theme configuration, property \"interpolation\" "
|
<< "RatingComponent: Invalid theme configuration, property \"interpolation\" "
|
||||||
"for element \""
|
"for element \""
|
||||||
|
|
|
@ -215,6 +215,16 @@ void VideoComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
mStaticImage.setRotation(mRotation);
|
mStaticImage.setRotation(mRotation);
|
||||||
mStaticImage.setRotationOrigin(mRotationOrigin);
|
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")) {
|
if (elem->has("interpolation")) {
|
||||||
const std::string& interpolation {elem->get<std::string>("interpolation")};
|
const std::string& interpolation {elem->get<std::string>("interpolation")};
|
||||||
if (interpolation == "linear") {
|
if (interpolation == "linear") {
|
||||||
|
@ -226,7 +236,6 @@ void VideoComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
|
||||||
mStaticImage.setLinearInterpolation(false);
|
mStaticImage.setLinearInterpolation(false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
mStaticImage.setLinearInterpolation(false);
|
|
||||||
LOG(LogWarning) << "VideoComponent: Invalid theme configuration, property "
|
LOG(LogWarning) << "VideoComponent: Invalid theme configuration, property "
|
||||||
"\"interpolation\" for element \""
|
"\"interpolation\" for element \""
|
||||||
<< element.substr(6) << "\" defined as \"" << interpolation << "\"";
|
<< element.substr(6) << "\" defined as \"" << interpolation << "\"";
|
||||||
|
|
Loading…
Reference in a new issue