[Internal testing communication] Deepin肖工Wayland协议屏幕截图裁剪功能AI给出的优化建议
Tofloor
poster avatar
kentrl
deepin
2025-09-03 15:03
Author

Deepin肖工Wayland协议屏幕截图裁剪功能AI给出的优化建议,快去更新代码,截图功能等着你。

image.png

image.png


  
    Set a rectangular region of the source to be captured. Subsequent capture
    requests will only include pixels from this region.

    The coordinates (x, y) specify the top-left corner of the cropping
    region relative to the source's coordinate system. The width and height
    specify the dimensions of the region to capture.

    If width or height are zero, or if the cropping region extends beyond
    the source boundaries, the invalid_cropping protocol error is raised.

    Passing all values as 0 will disable cropping and capture the entire source.
    This is the default state of a new session.
  
  
  
  
  

image.png

Reply Favorite View the author
All Replies
winee
deepin
2025-09-03 16:08
#1

如果你认为ai建议的不错或者有自己的想法,请在 freedesktop.org 的提交里参与讨论

Reply View the author
‌量子巡游者
deepin
Q&A Team
2025-09-03 20:19
#2

AI设计的思路很清晰,采用的方式方法也不错,不知道符不符合官方的整体设计要求,方案有待验证

Reply View the author
xiaoyaobing
deepin
2025-09-04 13:27
#3

你好我是这个MR的作者https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/440。

ext_image_copy_capture_session_v1这时候已经是create_source之后了,此时合成器会有一个事件用来通知客户端attach的wl_buffer size是多大,如果在这里 set_crop_region时机稍晚,那就意味着 set_crop_region将会成为一个必须调用的请求(如果设置了区域,那么我的目标是buffer的size会变的更小,从而节省内存和显存)。实际上我的设计目标是想让区域录制它变成可选的而不是必要的。


  
    
      This object represents an active image copy capture session.

      After a capture session is created, buffer constraint events will be
      emitted from the compositor to tell the client which buffer types and
      formats are supported for reading from the session. The compositor may
      re-send buffer constraint events whenever they change.

      To advertise buffer constraints, the compositor must send in no
      particular order: zero or more shm_format and dmabuf_format events, zero
      or one dmabuf_device event, and exactly one buffer_size event. Then the
      compositor must send a done event.

      When the client has received all the buffer constraints, it can create a
      buffer accordingly, attach it to the capture session using the
      attach_buffer request, set the buffer damage using the damage_buffer
      request and then send the capture request.
    

ext_image_copy_capture_session_v1

Reply View the author