Skip to content

fix: eliminate jagged corners on edit toolbar background - #431

Open
JWWTSL wants to merge 1 commit into
linuxdeepin:masterfrom
JWWTSL:agent/pms-bug-bot/1c1d70c9b1dd
Open

JWWTSL wants to merge 1 commit into
linuxdeepin:masterfrom
JWWTSL:agent/pms-bug-bot/1c1d70c9b1dd

Conversation

@JWWTSL

@JWWTSL JWWTSL commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

fix: eliminate jagged corners on edit toolbar background

  1. Root cause: DTK.FloatingPanel uses ItemViewport internally which
    generates a low-resolution corner mask texture with Nearest sampling
    and no anti-aliasing, producing visible jagged edges on rounded corners
  2. Fix: replace FloatingPanel with a custom background using Rectangle
    (radius: 18) whose corners are rendered by Qt Quick GPU pipeline with
    native anti-aliasing, plus DTK.BoxShadow for projection and a border
    Rectangle for the outline
  3. Impact: only EditToolbar background rendering changes; corners are now
    smooth. DTK.InWindowBlur is not used to avoid the known DTK bug (see
    ReName.qml:45) and unnecessary GPU overhead

Log: 修复图片编辑工具栏圆角锯齿问题

Influence:

  1. Test edit toolbar corner smoothness when zooming images in/out
  2. Verify toolbar shadow and background tint render correctly
  3. Confirm no visual regression on toolbar appearance

fix: 修复图片编辑工具栏圆角锯齿问题

  1. 根因:DTK.FloatingPanel 内部使用 ItemViewport 生成低分辨率圆角遮罩
    纹理,采用 Nearest 采样且未开启抗锯齿,导致圆角边缘出现明显锯齿
  2. 方案:将 FloatingPanel 替换为自定义背景,使用 Rectangle(radius: 18)
    实现圆角,Rectangle 圆角由 Qt Quick GPU 管线原生抗锯齿渲染;保留
    DTK.BoxShadow 投影和边框 Rectangle
  3. 影响:仅 EditToolbar 背景渲染方式变化,圆角变得平滑;不使用
    DTK.InWindowBlur 以规避已知 DTK bug(见 ReName.qml:45)及多余 GPU 开销

Log: 修复图片编辑工具栏圆角锯齿问题

Influence:

  1. 测试图片放大缩小后工具栏圆角是否平滑无锯齿
  2. 验证工具栏投影和背景色渲染正常
  3. 确认工具栏外观无视觉回归

PMS: BUG-381163

Summary by Sourcery

Improve edit toolbar background rendering to provide smooth rounded corners without changing its visual styling.

Bug Fixes:

  • Remove jagged edges from the edit toolbar’s rounded corners for smoother rendering.

Enhancements:

  • Replace the toolbar’s floating-panel background with a custom rounded background that preserves its shadow, tint, and outline styling.

1. Root cause: DTK.FloatingPanel uses ItemViewport internally which
   generates a low-resolution corner mask texture with Nearest sampling
   and no anti-aliasing, producing visible jagged edges on rounded corners
2. Fix: replace FloatingPanel with a custom background using Rectangle
   (radius: 18) whose corners are rendered by Qt Quick GPU pipeline with
   native anti-aliasing, plus DTK.BoxShadow for projection and a border
   Rectangle for the outline
3. Impact: only EditToolbar background rendering changes; corners are now
   smooth. DTK.InWindowBlur is not used to avoid the known DTK bug (see
   ReName.qml:45) and unnecessary GPU overhead

Log: 修复图片编辑工具栏圆角锯齿问题

Influence:
1. Test edit toolbar corner smoothness when zooming images in/out
2. Verify toolbar shadow and background tint render correctly
3. Confirm no visual regression on toolbar appearance

fix: 修复图片编辑工具栏圆角锯齿问题

1. 根因:DTK.FloatingPanel 内部使用 ItemViewport 生成低分辨率圆角遮罩
   纹理,采用 Nearest 采样且未开启抗锯齿,导致圆角边缘出现明显锯齿
2. 方案:将 FloatingPanel 替换为自定义背景,使用 Rectangle(radius: 18)
   实现圆角,Rectangle 圆角由 Qt Quick GPU 管线原生抗锯齿渲染;保留
   DTK.BoxShadow 投影和边框 Rectangle
3. 影响:仅 EditToolbar 背景渲染方式变化,圆角变得平滑;不使用
   DTK.InWindowBlur 以规避已知 DTK bug(见 ReName.qml:45)及多余 GPU 开销

Log: 修复图片编辑工具栏圆角锯齿问题

Influence:
1. 测试图片放大缩小后工具栏圆角是否平滑无锯齿
2. 验证工具栏投影和背景色渲染正常
3. 确认工具栏外观无视觉回归

PMS: BUG-381163
@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: JWWTSL

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@sourcery-ai

sourcery-ai Bot commented Oct 27, 2026

Copy link
Copy Markdown

Reviewer's Guide

The edit toolbar background is reimplemented with GPU-rendered rounded Rectangles, a preserved DTK.BoxShadow, and an explicit border, eliminating the low-resolution anti-aliased corner artifacts from DTK.FloatingPanel without changing toolbar behavior.

File-Level Changes

Change Details Files
Replace the edit toolbar’s DTK.FloatingPanel background with layered custom Qt Quick items to remove jagged rounded corners.
  • Use a radius-18 Rectangle for the tinted toolbar surface.
  • Retain the drop shadow through DTK.BoxShadow with hollow rendering and adjusted blur/offset.
  • Add a separate rounded Rectangle border for the outline.
  • Avoid DTK.InWindowBlur due to a known bug and unnecessary GPU work.
src/qml/EditToolbar.qml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@deepin-ci-robot

Copy link
Copy Markdown

deepin pr auto review

🤖 AI 代码审查报告

总体评分: 99 分 (通过阈值: 70分)

Pass


📊 总体评价

项目 结果
审查结论 代码审查通过
评分详情 本次变更用自定义 Item 背景(BoxShadow + Rectangle)替代 DTK.FloatingPanel,从根本上解决了圆角锯齿问题。QML 语法正确,注释详尽且解释了设计决策,代码结构清晰。无安全漏洞。仅存在魔法数字硬编码的轻微优化建议。

🔍 详细分析

1. 语法逻辑 ✅

评价: 语法正确,逻辑清晰 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: []


2. 代码质量 ✅

评价: 代码结构清晰,注释完整 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['建议将圆角半径 18 提取为自定义属性(如 property int cornerRadius: 18),BoxShadow 的 cornerRadius 和两个 Rectangle 的 radius 统一引用该属性,避免多处硬编码同一值导致修改不一致。']


3. 代码性能 ✅

评价: 性能良好,资源使用合理 ✅ 通过

潜在问题:
✅ 未发现明显问题

建议: ['将 18 提取为 property int cornerRadius: 18,BoxShadow 与两个 Rectangle 统一引用', '将常用样式参数集中定义为属性组,便于主题切换和统一调整']


4. 代码安全 🔒

评价: 存在0个安全漏洞 ✅ 通过

🔐 发现 0 个安全漏洞

安全漏洞详情:
✅ 未发现安全漏洞

建议: []


💡 改进建议代码示例

// 建议将魔法数字提取为属性,提高可维护性
DTK.Control {
    // 统一定义样式参数
    property int cornerRadius: 18
    property real bgAlpha: 0.72
    property real shadowAlpha: 0.24
    property real borderAlpha: 0.12

    background: Item {
        Accessible.ignored: true
        implicitHeight: editToolbar.implicitHeight

        DTK.BoxShadow {
            anchors.fill: parent
            cornerRadius: editToolbar.cornerRadius
            hollow: true
            shadowBlur: 20
            shadowColor: Qt.rgba(editToolbar.palette.shadow.r,
                                 editToolbar.palette.shadow.g,
                                 editToolbar.palette.shadow.b, editToolbar.shadowAlpha)
            shadowOffsetY: 6
        }

        Rectangle {
            anchors.fill: parent
            radius: editToolbar.cornerRadius
            color: Qt.rgba(editToolbar.palette.window.r,
                           editToolbar.palette.window.g,
                           editToolbar.palette.window.b, editToolbar.bgAlpha)
        }

        Rectangle {
            anchors.fill: parent
            radius: editToolbar.cornerRadius
            color: "transparent"
            border.color: Qt.rgba(editToolbar.themeTextColor.r,
                                  editToolbar.themeTextColor.g,
                                  editToolbar.themeTextColor.b, editToolbar.borderAlpha)
            border.width: 1
        }
    }
}

本报告由 AI 代码审查工具自动生成

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants