启用桌面合成时是否需要双缓冲? [英] Is Double-buffering required with Desktop Composition enabled?

查看:165
本文介绍了启用桌面合成时是否需要双缓冲?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

启用桌面合成后是否仍需要双缓冲?

Is double-buffering still required when Desktop Composition is enabled?

在Microsoft的应用程序兼容性指南

In Microsoft's Application Compatibility Guide:


图形设备接口(GDI)

在Windows Vista和Windows
Server 2008之前,窗口句柄(HWND)
被直接绘制到屏幕,
具有一定的优势,但是
限制了Windows的显示方式以及
管理顶级窗口的方式。在Windows
Vista和Windows Server 2008中,所有
顶级窗口都呈现为
屏外位图(类似于
WS_EX_LAYERED),而桌面窗口为
Manager将图像
组合在一起以绘制桌面。

Prior to Windows Vista and Windows Server 2008, a window handle (HWND) was painted directly to the screen, which had certain benefits, but limited how Windows could display and manage top-level windows. In Windows Vista and Windows Server 2008, all top-level windows are rendered to an off-screen bitmap (similar to WS_EX_LAYERED), and the Desktop Window Manager combines the images together to draw the desktop.

听起来现在所有渲染都完成了,屏幕位图:

It sounds like all rendering is now done to an off-screen bitmap:


将窗口渲染为屏幕外位图

windows are rendered to an off-screen bitmap

这是正确的吗?

我问的原因是因为在标准喷漆周期中我仍然看到闪烁:

The reason i ask is because i still see flickering during the standard paint cycle:


  • WM_ERASEBKGND

  • WM_PAINT

启用桌面合成后:

< img src = https://i.stack.imgur.com/KRxq3.png alt =替代文字>

我本以为在

   BeginPaint(hWnd, paintStructure);
   ...
   EndPaint(hWnd, paintStructure);

所有绘画都将发生在后缓冲区:

that all painting would happen to a back buffer:


窗口被渲染到屏幕外的位图

windows are rendered to an off-screen bitmap

同时前缓冲区将保留

推荐答案


这是正确的吗?

Is this correct?

是的(通过缩略图可以显示当前被遮挡的窗口部分)。

Yup (which is how the thumbnails can show you parts of the window that are currently obscured).

DWM渲染屏幕是双缓冲的。但是,如果它在擦除和绘画之前占据了缓冲区,它将以可见的人工制品出现。因此,您仍然需要加倍缓冲。双重缓冲发生在桌面上(即完全绘制下一个桌面视图,然后翻转),而不是在绘制每个窗口的屏幕外缓冲区上。

DWM's rendering of the screen is double-buffered. However, if it grabs your buffer betewen erasing and painting... it's going to show up as a visible artefact. So you still need to double buffer. The double buffering occurs on the desktop (i.e. it draws the next desktop view completely and then flips), not on the off-screen buffers that each window is drawn to.

这篇关于启用桌面合成时是否需要双缓冲?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆