Skip to content

fix(capture): use buffer pixel size for capture constraints and damage on fractional scales - #1224

Draft
glyvut wants to merge 1 commit into
linuxdeepin:masterfrom
glyvut:rec-size
Draft

fix(capture): use buffer pixel size for capture constraints and damage on fractional scales#1224
glyvut wants to merge 1 commit into
linuxdeepin:masterfrom
glyvut:rec-size

Conversation

@glyvut

@glyvut glyvut commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Use wlr_surface buffer_width/buffer_height instead of logical width/height for initial buffer_size constraints and per-frame damage regions. Fixes truncated capture output on fractional-scale (e.g. 1.25x) screens where logical and buffer pixel sizes differ.

在分数倍缩放屏幕(如1.25x)上,使用buffer像素尺寸
而非逻辑尺寸设置捕获约束和damage区域,修复画面
被截断为逻辑尺寸的问题。

Log: 修复分数倍缩放下窗口捕获画面截断
Influence: 分数倍缩放屏幕上的窗口捕获现在返回完整
画面,不再出现黑边截断。

Summary by Sourcery

Bug Fixes:

  • Prevent truncated and black-bordered capture output on fractional-scale screens by basing initial constraints and per-frame damage on buffer pixel size instead of logical size.

constraints and damage on fractional scales

Use wlr_surface buffer_width/buffer_height instead of
logical width/height for initial buffer_size constraints
and per-frame damage regions. Fixes truncated capture
output on fractional-scale (e.g. 1.25x) screens where
logical and buffer pixel sizes differ.

在分数倍缩放屏幕(如1.25x)上,使用buffer像素尺寸
而非逻辑尺寸设置捕获约束和damage区域,修复画面
被截断为逻辑尺寸的问题。

Log: 修复分数倍缩放下窗口捕获画面截断
Influence: 分数倍缩放屏幕上的窗口捕获现在返回完整
画面,不再出现黑边截断。
@deepin-ci-robot

Copy link
Copy Markdown

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@deepin-ci-robot

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: glyvut

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 Jul 30, 2026

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

This PR switches image capture sizing and damage calculations from logical surface dimensions to buffer pixel dimensions to fix truncated captures on fractional-scale displays.

Sequence diagram for buffer-based damage calculation in handleRenderEnd

sequenceDiagram
    participant WExtImageCaptureSourceV1Impl
    participant WSurfaceContent
    participant WSurface
    participant WSurfaceHandle
    participant wlr_surface
    participant WPixmanRegion
    participant FrameSignal

    WExtImageCaptureSourceV1Impl->>WSurfaceContent: surface()
    WSurfaceContent-->>WExtImageCaptureSourceV1Impl: WSurface
    WExtImageCaptureSourceV1Impl->>WSurface: handle()
    WSurface-->>WExtImageCaptureSourceV1Impl: WSurfaceHandle
    WExtImageCaptureSourceV1Impl->>WSurfaceHandle: handle()
    WSurfaceHandle-->>WExtImageCaptureSourceV1Impl: wlr_surface

    WExtImageCaptureSourceV1Impl->>wlr_surface: read current.buffer_width
    WExtImageCaptureSourceV1Impl->>wlr_surface: read current.buffer_height

    alt [bufferWidth <= 0 or bufferHeight <= 0]
        WExtImageCaptureSourceV1Impl->>WExtImageCaptureSourceV1Impl: qCWarning(lcWlImageCapture)
        WExtImageCaptureSourceV1Impl-->>WExtImageCaptureSourceV1Impl: return
    else [valid buffer size]
        WExtImageCaptureSourceV1Impl->>WPixmanRegion: WPixmanRegion(0,0,bufferWidth,bufferHeight)
        WExtImageCaptureSourceV1Impl->>FrameSignal: wl_signal_emit_mutable(events.frame,event)
    end
Loading

File-Level Changes

Change Details Files
Use wlr_surface buffer pixel dimensions for capture constraints and damage region instead of logical surface size.
  • In the constructor, read wlr_surface->current.buffer_width and buffer_height when initializing capture constraints, instead of current.width/height logical dimensions.
  • In handleRenderEnd(), obtain the current wlr_surface from m_surfaceContent->surface() and read current.buffer_width/buffer_height for the damage region size.
  • Replace the use of m_surfaceContent->size() for damage region bounds with the buffer pixel width/height when creating WPixmanRegion.
  • Update logging to report buffer pixel dimensions in debug and warning output for damage region handling.
waylib/src/server/utils/wextimagecapturesourcev1impl.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!

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

@deepin-bot

deepin-bot Bot commented Jul 31, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.8.17
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1229

@glyvut

glyvut commented Jul 31, 2026

Copy link
Copy Markdown
Contributor Author

可能会有一个大重写,直接带着这个问题一次性都解掉

@deepin-bot

deepin-bot Bot commented Aug 14, 2026

Copy link
Copy Markdown

TAG Bot

New tag: 0.8.18
DISTRIBUTION: unstable
Suggest: synchronizing this PR through rebase #1286

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