[vlc-commits] [Git][videolan/vlc][master] qt: don't scale radius for drop shadow effect

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun Apr 9 09:45:54 UTC 2023



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
5db6d3c8 by Prince Gupta at 2023-04-09T07:59:11+00:00
qt: don't scale radius for drop shadow effect

improves batching and reduces size of generated effect

- - - - -


1 changed file:

- modules/gui/qt/util/effects_image_provider.cpp


Changes:

=====================================
modules/gui/qt/util/effects_image_provider.cpp
=====================================
@@ -77,12 +77,12 @@ public:
             // Copy the mask
             QPainter painter(&ret);
             painter.setCompositionMode(QPainter::CompositionMode_Source);
-            const auto radius = effectiveBlurRadius();
+            const auto radius = m_blurRadius;
             painter.drawImage(radius + m_xOffset, radius + m_yOffset, mask);
         }
 
         // Blur the mask
-        qt_blurImage(ret, effectiveBlurRadius(), false);
+        qt_blurImage(ret, m_blurRadius, false);
 
         return ret;
     }
@@ -90,8 +90,8 @@ public:
     constexpr QSize boundingSize(const QSize& size) const
     {
         // Size of bounding rectangle of the effect
-        const qreal radius = 2 * effectiveBlurRadius();
-        return size + QSize(qAbs(m_xOffset) + radius, qAbs(m_yOffset) + radius);
+        const qreal diameter = m_blurRadius * 2;
+        return size + QSize(qAbs(m_xOffset) + diameter, qAbs(m_yOffset) + diameter);
     }
 
 protected:
@@ -99,13 +99,6 @@ protected:
     QColor m_color {63, 63, 63, 180};
     qreal m_xOffset = 0.0;
     qreal m_yOffset = 0.0;
-
-private:
-    constexpr qreal effectiveBlurRadius() const
-    {
-        // Translated blur radius for the Qt blur algorithm
-        return 2.5 * (m_blurRadius + 1);
-    }
 };
 
 class RoundedRectDropShadowEffect : public RectDropShadowEffect



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/5db6d3c820ec004f54fec9474d950746eaf3a3d0

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/5db6d3c820ec004f54fec9474d950746eaf3a3d0
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list