Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion qt6/src/qml/OutsideBoxBorder.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
// SPDX-License-Identifier: LGPL-3.0-or-later

import QtQuick
import QtQuick.Window

Item {
property real borderWidth: 1
property real borderWidth: 1 / Screen.devicePixelRatio
property color color: "white"
property real radius: 0

Expand Down
6 changes: 3 additions & 3 deletions qt6/src/shaders_ng/quickitemviewport-opaque.frag
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ void main()
lowp vec4 mask_bottom_left = texture(mask, tex_bottom_left);
lowp vec4 mask_top_right = texture(mask, tex_top_right);
lowp vec4 mask_bottom_right = texture(mask, tex_bottom_right);
lowp vec4 mask_tex = mask_top_left * mask_bottom_left * mask_top_right * mask_bottom_right;
lowp float mask_alpha = min(min(mask_top_left.a, mask_bottom_left.a), min(mask_top_right.a, mask_bottom_right.a));

if (mask_tex.a == 0.0)
if (mask_alpha == 0.0)
discard;

lowp vec4 tex = texture(qt_Texture, qt_TexCoord);

fragColor = tex * mask_tex.a;
fragColor = tex * mask_alpha;
}
6 changes: 3 additions & 3 deletions qt6/src/shaders_ng/quickitemviewport.frag
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ void main()
lowp vec4 mask_bottom_left = texture(mask, tex_bottom_left);
lowp vec4 mask_top_right = texture(mask, tex_top_right);
lowp vec4 mask_bottom_right = texture(mask, tex_bottom_right);
lowp vec4 mask_tex = mask_top_left * mask_bottom_left * mask_top_right * mask_bottom_right;
lowp float mask_alpha = min(min(mask_top_left.a, mask_bottom_left.a), min(mask_top_right.a, mask_bottom_right.a));

if (mask_tex.a == 0.0)
if (mask_alpha == 0.0)
discard;

lowp vec4 tex = texture(qt_Texture, qt_TexCoord);

fragColor = tex * mask_tex.a * ubuf.opacity;
fragColor = tex * mask_alpha * ubuf.opacity;
}
2 changes: 1 addition & 1 deletion src/qml/InsideBoxBorder.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import QtQuick 2.0

Item {
property real borderWidth: 1
property real borderWidth: 1 / Screen.devicePixelRatio

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): The Qt5 QML files reference Screen.devicePixelRatio without importing QtQuick.Window, where the Screen attached property is defined. When either border component is loaded, the binding cannot resolve Screen, so borderWidth is invalid instead of evaluating to the intended device-independent width.

Triggers: When either Qt5 InsideBoxBorder or OutsideBoxBorder component is instantiated.

Suggested fix: Add the appropriate import QtQuick.Window version to both Qt5 QML files before using Screen.devicePixelRatio.

property color color: Qt.rgba(1, 1, 1, 0.15)
property alias radius: rect.radius

Expand Down
2 changes: 1 addition & 1 deletion src/qml/OutsideBoxBorder.qml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import QtQuick 2.0

Item {
property real borderWidth: 1
property real borderWidth: 1 / Screen.devicePixelRatio
property color color: "white"
property real radius: 0

Expand Down
9 changes: 5 additions & 4 deletions src/shaders/quickitemviewport-opaque.frag
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ void main()
lowp vec4 mask_top_right = texture2D(mask, tex_top_right);
lowp vec4 mask_bottom_right = texture2D(mask, tex_bottom_right);

lowp vec4 tex = texture2D(qt_Texture, qt_TexCoord);
lowp float mask_alpha = min(min(mask_top_left.a, mask_bottom_left.a), min(mask_top_right.a, mask_bottom_right.a));
if (mask_alpha == 0.0)
discard;

// 统一计算此像素点被模板遮盖后的颜色,此处不需要区分点是否在某个区域,不在此区域时取出的mask颜色的alpha值必为1
tex *= mask_top_left * mask_bottom_left * mask_top_right * mask_bottom_right;
gl_FragColor = tex * tex.a;
lowp vec4 tex = texture2D(qt_Texture, qt_TexCoord);
gl_FragColor = tex * mask_alpha;
}
9 changes: 5 additions & 4 deletions src/shaders/quickitemviewport.frag
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ void main()
lowp vec4 mask_top_right = texture2D(mask, tex_top_right);
lowp vec4 mask_bottom_right = texture2D(mask, tex_bottom_right);

lowp vec4 tex = texture2D(qt_Texture, qt_TexCoord);
lowp float mask_alpha = min(min(mask_top_left.a, mask_bottom_left.a), min(mask_top_right.a, mask_bottom_right.a));
if (mask_alpha == 0.0)
discard;

// 统一计算此像素点被模板遮盖后的颜色,此处不需要区分点是否在某个区域,不在此区域时取出的mask颜色的alpha值必为1
tex *= mask_top_left * mask_bottom_left * mask_top_right * mask_bottom_right;
gl_FragColor = tex * tex.a * opacity;
lowp vec4 tex = texture2D(qt_Texture, qt_TexCoord);
gl_FragColor = tex * mask_alpha * opacity;
}
Loading