[vlc-commits] [Git][videolan/vlc][master] 2 commits: qml: add a note regarding "hypothetical clip test"
Steve Lhomme (@robUx4)
gitlab at videolan.org
Mon May 26 13:24:03 UTC 2025
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
7e6b23db by Fatih Uzunoglu at 2025-05-26T13:02:57+00:00
qml: add a note regarding "hypothetical clip test"
I remember that I have mentioned this before, but
it is better to have this as a comment in the code
base where we can refer in the future.
- - - - -
83539313 by Fatih Uzunoglu at 2025-05-26T13:02:57+00:00
qml: use `DefaultShadow` in `PIPPlayer`
- - - - -
2 changed files:
- modules/gui/qt/player/qml/PIPPlayer.qml
- modules/gui/qt/widgets/qml/RoundedRectangleShadow.qml
Changes:
=====================================
modules/gui/qt/player/qml/PIPPlayer.qml
=====================================
@@ -95,6 +95,12 @@ T.Control {
background: VideoSurface {
id: videoSurface
videoSurfaceProvider: MainCtx.videoSurfaceProvider
+
+ // It is acceptable for effects to exceed the boundaries of the
+ // parent. They are an exception to the "hypothetical clip test".
+ Widgets.DefaultShadow {
+
+ }
}
contentItem: Rectangle {
=====================================
modules/gui/qt/widgets/qml/RoundedRectangleShadow.qml
=====================================
@@ -23,6 +23,16 @@ import QtQuick
// Qt 5's `RectangularGlow` that this uses proper approximation of gaussian blur instead of relying on
// `smoothstep()`, which I assume is good for glow effect but not for shadows.
ShaderEffect {
+
+ // Normally an "hypothetical clip test" should be done when adding a child to an item (parent) that exceeds the
+ // boundaries of that item, which is simply asking the question: "if clipping was enabled in the parent, would it
+ // change anything?". If the answer is yes, the parent item's size should be adjusted to cover the size of the
+ // newly added child. However, there are exceptions to this, the first exception is when clipping is used as a
+ // visual effect to actually have clipping. Another exception is with effects that are by definition supposed to
+ // exceed the boundaries of the parent item, such as shadow and glow effects. In this case, the bounding box of
+ // the effect is a derivative of the parent's size, and two things can not be based on each other. Since effects
+ // are purely for visual aesthetics, it is acceptable if they get clipped (for any reason, which can be using
+ // `grabToImage()`, for example).
implicitWidth: parent ? Math.min((parent.paintedWidth ?? Number.MAX_VALUE) - Math.ceil(parent.padding ?? 0) * 2, parent.width) + (blurRadius * compensationFactor * 2)
: 0
implicitHeight: parent ? Math.min((parent.paintedHeight ?? Number.MAX_VALUE) - Math.ceil(parent.padding ?? 0) * 2, parent.height) + (blurRadius * compensationFactor * 2)
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/20fe1d3535e2800b2c54dc94d67be018fce708fc...83539313f6c90100dc548058a98927d2f7705498
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/20fe1d3535e2800b2c54dc94d67be018fce708fc...83539313f6c90100dc548058a98927d2f7705498
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