diff --git a/es-core/src/components/BadgeComponent.cpp b/es-core/src/components/BadgeComponent.cpp index 609b22b8c..fa5fc95df 100644 --- a/es-core/src/components/BadgeComponent.cpp +++ b/es-core/src/components/BadgeComponent.cpp @@ -301,6 +301,14 @@ void BadgeComponent::applyTheme(const std::shared_ptr& 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("rotation"))}; + if (rotation != 0.0f && + (std::round(rotation) != rotation || static_cast(rotation) % 90 != 0)) + mLinearInterpolation = true; + } + if (elem->has("interpolation")) { const std::string& interpolation {elem->get("interpolation")}; if (interpolation == "linear") { diff --git a/es-core/src/components/GIFAnimComponent.cpp b/es-core/src/components/GIFAnimComponent.cpp index d50955081..2b453fda6 100644 --- a/es-core/src/components/GIFAnimComponent.cpp +++ b/es-core/src/components/GIFAnimComponent.cpp @@ -373,9 +373,13 @@ void GIFAnimComponent::applyTheme(const std::shared_ptr& theme, mIterationCount *= 2; } - if (elem->has("cornerRadius")) - mCornerRadius = - glm::clamp(elem->get("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("rotation"))}; + if (rotation != 0.0f && + (std::round(rotation) != rotation || static_cast(rotation) % 90 != 0)) + mTexture->setLinearMagnify(true); + } if (elem->has("interpolation")) { const std::string& interpolation {elem->get("interpolation")}; @@ -386,13 +390,16 @@ void GIFAnimComponent::applyTheme(const std::shared_ptr& 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("cornerRadius"), 0.0f, 0.5f) * mRenderer->getScreenWidth(); + if (properties & COLOR) { if (elem->has("color")) { mColorShift = elem->get("color"); diff --git a/es-core/src/components/ImageComponent.cpp b/es-core/src/components/ImageComponent.cpp index c10812602..1f80e2f25 100644 --- a/es-core/src/components/ImageComponent.cpp +++ b/es-core/src/components/ImageComponent.cpp @@ -548,6 +548,14 @@ void ImageComponent::applyTheme(const std::shared_ptr& 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("rotation"))}; + if (rotation != 0.0f && + (std::round(rotation) != rotation || static_cast(rotation) % 90 != 0)) + mLinearInterpolation = true; + } + if (elem->has("interpolation")) { const std::string& interpolation {elem->get("interpolation")}; if (interpolation == "linear") { @@ -557,7 +565,6 @@ void ImageComponent::applyTheme(const std::shared_ptr& theme, mLinearInterpolation = false; } else { - mLinearInterpolation = false; LOG(LogWarning) << "ImageComponent: Invalid theme configuration, property " "\"interpolation\" for element \"" << element.substr(6) << "\" defined as \"" << interpolation << "\""; diff --git a/es-core/src/components/LottieAnimComponent.cpp b/es-core/src/components/LottieAnimComponent.cpp index a2ba86f94..a62d5eb3e 100644 --- a/es-core/src/components/LottieAnimComponent.cpp +++ b/es-core/src/components/LottieAnimComponent.cpp @@ -343,6 +343,14 @@ void LottieAnimComponent::applyTheme(const std::shared_ptr& 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("rotation"))}; + if (rotation != 0.0f && + (std::round(rotation) != rotation || static_cast(rotation) % 90 != 0)) + mTexture->setLinearMagnify(true); + } + if (elem->has("interpolation")) { const std::string& interpolation {elem->get("interpolation")}; if (interpolation == "linear") { @@ -352,7 +360,6 @@ void LottieAnimComponent::applyTheme(const std::shared_ptr& theme, mTexture->setLinearMagnify(false); } else { - mTexture->setLinearMagnify(false); LOG(LogWarning) << "LottieAnimComponent: Invalid theme configuration, property " "\"interpolation\" for element \"" << element.substr(10) << "\" defined as \"" << interpolation << "\""; diff --git a/es-core/src/components/RatingComponent.cpp b/es-core/src/components/RatingComponent.cpp index 3434771a4..6523d85a6 100644 --- a/es-core/src/components/RatingComponent.cpp +++ b/es-core/src/components/RatingComponent.cpp @@ -229,6 +229,14 @@ void RatingComponent::applyTheme(const std::shared_ptr& 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("rotation"))}; + if (rotation != 0.0f && + (std::round(rotation) != rotation || static_cast(rotation) % 90 != 0)) + linearInterpolation = true; + } + if (elem->has("interpolation")) { const std::string& interpolation {elem->get("interpolation")}; if (interpolation == "linear") { @@ -238,8 +246,6 @@ void RatingComponent::applyTheme(const std::shared_ptr& theme, linearInterpolation = false; } else { - linearInterpolation = false; - LOG(LogWarning) << "RatingComponent: Invalid theme configuration, property \"interpolation\" " "for element \"" diff --git a/es-core/src/components/VideoComponent.cpp b/es-core/src/components/VideoComponent.cpp index e8ed0e0e1..8e8b2f9a5 100644 --- a/es-core/src/components/VideoComponent.cpp +++ b/es-core/src/components/VideoComponent.cpp @@ -215,6 +215,16 @@ void VideoComponent::applyTheme(const std::shared_ptr& 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("rotation"))}; + if (rotation != 0.0f && + (std::round(rotation) != rotation || static_cast(rotation) % 90 != 0)) { + mLinearInterpolation = true; + mStaticImage.setLinearInterpolation(true); + } + } + if (elem->has("interpolation")) { const std::string& interpolation {elem->get("interpolation")}; if (interpolation == "linear") { @@ -226,7 +236,6 @@ void VideoComponent::applyTheme(const std::shared_ptr& theme, mStaticImage.setLinearInterpolation(false); } else { - mStaticImage.setLinearInterpolation(false); LOG(LogWarning) << "VideoComponent: Invalid theme configuration, property " "\"interpolation\" for element \"" << element.substr(6) << "\" defined as \"" << interpolation << "\"";