Skip to content

Conversation

@mhduiy
Copy link
Contributor

@mhduiy mhduiy commented Mar 27, 2025

Draw directly using the original image and remove anti aliasing

pms: BUG-285265

Summary by Sourcery

Bug Fixes:

  • Fix blurry window previews by removing smooth scaling and anti-aliasing transformations

@mhduiy mhduiy requested a review from 18202781743 March 27, 2025 08:38
@sourcery-ai
Copy link

sourcery-ai bot commented Mar 27, 2025

Reviewer's Guide by Sourcery

This pull request enhances the clarity of window previews by directly utilizing the original image and eliminating anti-aliasing. The changes involve removing the pixmap scaling with smooth transformation, disabling anti-aliasing render hints, and drawing the original pixmap.

Updated class diagram for AppItemWindowDeletegate

classDiagram
  class AppItemWindowDeletegate {
    -radius: int
    +paint(painter: QPainter, option: QStyleOptionViewItem, index: QModelIndex)
  }

  note for AppItemWindowDeletegate.paint "Removes anti-aliasing and draws the original pixmap"
Loading

File-Level Changes

Change Details Files
Improved window preview clarity by drawing directly from the original image and disabling anti-aliasing.
  • Removed the scaling with smooth transformation of the pixmap.
  • Removed setting render hints for anti-aliasing and smooth pixmap transform.
  • Draw the original pixmap instead of the scaled pixmap.
panels/dock/taskmanager/x11preview.cpp

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!
  • Generate a plan of action for an issue: Comment @sourcery-ai plan on
    an issue to generate a plan of action for it.

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

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey @mhduiy - I've reviewed your changes - here's some feedback:

Overall Comments:

  • Consider extracting the image drawing logic into a separate function for better readability.
Here's what I looked at during the review
  • 🟢 General issues: all looks good
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: 18202781743, mhduiy

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

Draw directly using the original image and remove anti aliasing

pms: BUG-285265
@deepin-ci-robot
Copy link

deepin pr auto review

代码审查意见:

  1. 代码简化

    • 删除了不必要的scaledPixmap变量和相关的代码,简化了逻辑。这是好的做法,因为它减少了代码的复杂性和潜在的错误点。
  2. 性能优化

    • 直接使用原始的pixmap绘制,而不是先缩放再绘制,这可能会提高性能,因为减少了不必要的图像处理步骤。
  3. 代码可读性

    • 修改后的代码更加简洁,但是可能需要添加一些注释来解释为什么直接使用原始的pixmap,而不是先缩放再绘制。这有助于其他开发者理解代码的意图。
  4. 设备像素比

    • 原代码中设置了scaledPixmap.setDevicePixelRatio(qApp->devicePixelRatio());,但在简化后的代码中这一行被删除了。如果这个设置对于显示效果很重要,那么应该保留这一行代码。
  5. 抗锯齿和图像平滑

    • 原代码中设置了painter->setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);,但在简化后的代码中这一行也被删除了。如果抗锯齿和图像平滑对于显示效果很重要,那么应该保留这一行代码。
  6. 代码风格

    • 修改后的代码在计算imageRect时使用了size.width()size.height(),而不是scaledPixmap.width()scaledPixmap.height()。这是一个好的做法,因为它与原始的pixmap大小保持一致。

总体来说,代码的简化是积极的,但需要确保相关的显示效果和性能要求仍然得到满足。如果原始的缩放和设备像素比设置对于显示效果至关重要,那么应该考虑恢复这些代码。

@18202781743
Copy link
Contributor

/forcemerge

@deepin-bot
Copy link

deepin-bot bot commented Mar 27, 2025

This pr force merged! (status: blocked)

@deepin-bot deepin-bot bot merged commit a27b743 into linuxdeepin:master Mar 27, 2025
7 of 10 checks passed
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.

3 participants