Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • T TrafficMonitor
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 813
    • Issues 813
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 3
    • Merge requests 3
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • zhongyang219
  • TrafficMonitor
  • Merge requests
  • !1156

提供了Direct2D渲染支持,大幅提升任务栏窗口透明渲染效果

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Dusk requested to merge github/fork/BombaxCeiba/TransparentSupport into master Apr 29, 2022
  • Overview 13
  • Commits 70
  • Pipelines 0
  • Changes 44

下载

GitHub Action *下载方式:点击上面的 GitHub Action ,进入后选择带TransparentSupport标识的最新的一项点进去,拉到网页最下面,32位系统选择x86开头的文件下载,64位系统选择x64开头的文件下载即可。

系统兼容性

程序在Windows 11 22000.918上正常工作,但因为在Windows 7和Windows 8上任务栏窗口调用函数UpdateLayeredWindowIndirect更新窗口内容时会失败并得到错误87,所以这一功能暂不支持这两个系统版本。

对于Windows 8.1以及以上的系统版本,由于支持Direct Composition,在UpdateLayeredWindowIndirect失败后会使用Direct Composition对D2D渲染结果进行呈现。

在Windows Server 2022 20348.1366上,也会因为相同的原因使用Direct Composition进行呈现。

HDR兼容性

程序在Windows Server 2022 20348.1366上,在使用Direct Composition时可以正常呈现。

D2D渲染实现说明

通过对原有的CDrawCommon类在CTaskBarDlg类的ShowInfo方法中用到的函数进行提取后,添加了apha参数后单独放到IDrawCommon类中定义为纯虚函数。再将ShowInfo中用到的CDrawCommon类全部替换为IDrawCommon来实现对老代码的兼容。

D2D和GDI互操作

为了兼容插件的GDI调用,所有插件的绘制会被重定向到一个临时的DIB上,并且插件(包括通过MFC间接)调用的User32.dll中的DrawText和DrawTextEx系列函数都会被hook到一个支持透明度的版本上。在插件绘制完成后,DIB会被上传到显卡。显卡会将透明度为1的值(对应未被GDI绘制过的部分)修改为0,将透明度为0的值修改为255(对应被GDI绘制过的部分),其余透明度的值保留,得到的结果再和程序绘制的部分相叠加以得到最终显示用的结果。

由于微软的神奇bug,IDXGISurface1::GetDC的调用会偶尔出现下面这种报错:

0x00007FFD8D73474C 处(位于 TrafficMonitor.exe 中)引发的异常: Microsoft C++ 异常: _com_error,位于内存位置 0x000000FDDC3AB6C8 处。

可以不用理会。

禁用D2D绘图

找到任务栏窗口设置,勾选这个(在最下面的)选项即可 image

D2D绘图和GDI绘图效果对比

D2D: image image

GDI: image image

*使用D2D渲染时,可以避免背景颜色变化导致的闪烁现象。 并且D2D内存占用大一点

fix #955 (closed) fix #837 (closed) fix #1068 (closed)

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/BombaxCeiba/TransparentSupport