Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优化双线性插值下单色光标和彩色掩码光标的渲染效果 #855

Merged
merged 5 commits into from
Mar 24, 2024

Conversation

Blinue
Copy link
Owner

@Blinue Blinue commented Mar 21, 2024

Close #853

Desktop Duplication 的文档记录了不同类型的光标的工作方式:DXGI_OUTDUPL_POINTER_SHAPE_TYPE

单色光标和彩色掩码光标均涉及到掩码操作,双线性插值对它们没有意义,但有些老游戏使用这两种光标却不使用掩码。在当前实现下,即使使用双线性插值,这些光标依然有锐利的边缘,这是因为从不应用掩码状态到应用掩码/透明状态是突变的。

双线性插值下的单色光标:
image

此 PR:
image

此 PR 将兼容的单色光标和彩色掩码光标转换为彩色光标。彩色光标的优势在于:

  1. 渲染更快,因为可以使用图形管线的混合状态来实现透明度,避免了复制原始纹理。
  2. 可以使用预乘 Alpha 优化线性插值结果,使得透明像素和非透明像素之间有着平滑的过渡。

对于使用了掩码的光标不支持双线性插值,它们将始终使用最近邻插值。这样的光标非常少,且双线性插值对它们没有意义,比如最常见的有着反色区域的 I 形光标。

@Blinue Blinue added the enhancement New feature or request label Mar 21, 2024
@Blinue Blinue merged commit 3cdf2c2 into render-system Mar 24, 2024
4 checks passed
@Blinue Blinue deleted the cursor-scaling branch March 24, 2024 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant