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

3.3.0 Windows flickering / slow rendering #23585

Open
kfsone opened this issue Jun 1, 2023 · 6 comments
Open

3.3.0 Windows flickering / slow rendering #23585

kfsone opened this issue Jun 1, 2023 · 6 comments
Labels
MSW regression Worked previously, doesn't work any longer
Milestone

Comments

@kfsone
Copy link

kfsone commented Jun 1, 2023

It looks like this commit: fcc7430 doesn't take into account that a lot of things turn WS_EX_COMPOSITED off, such as listctrls and sizers.

After switching from 3.2.0 to 3.3.0 we're seeing a lot of flickering and slow rendering, with wxBG_STYLE_PAINT background style using a wxAutoBufferedPaintDC/wxGCDC.

@vadz vadz added this to the 3.3.0 milestone Jun 1, 2023
@vadz vadz added regression Worked previously, doesn't work any longer MSW labels Jun 1, 2023
@vadz
Copy link
Contributor

vadz commented Jun 1, 2023

I've replied here before seeing this issue, but let me copy the text here too:

True, I hadn't thought we'd have to turn it off in some pretty common cases. Unfortunately I don't think there is any way to convince LISTVIEW to work inside a composited window (which is pretty weird, when you think about it, but apparently this control does some strange internal painting optimizations which don't work in this case), so I guess we're going to need to just revert this commit or at least I don't see anything better to do. If anyone has any ideas, please let me know.

@kfsone
Copy link
Author

kfsone commented Jun 1, 2023

Oh and the appearance of two users with the problem wasn't intentional - Tommy and I are both Super Evil (actual company name: Super Evil Mega Corp :))

vadz added a commit to vadz/wxWidgets that referenced this issue Jun 4, 2023
It seems that simply creating wxPaintDC, i.e. calling BeginPaint(),
ourselves and then letting the native control draw into it, disables
whichever optimizations are used by the control that break its drawing
with WS_EX_COMPOSITED, so always do this in our OnPaint(), even if we
don't need to draw anything ourselves.

This allows to avoid disabling WS_EX_COMPOSITED when wxListCtrl is used,
which resulted in horrible flicker before.

See wxWidgets#23585.
vadz added a commit to vadz/wxWidgets that referenced this issue Jun 4, 2023
It seems that simply creating wxPaintDC, i.e. calling BeginPaint(),
ourselves and then letting the native control draw into it, disables
whichever optimizations are used by the control that break its drawing
with WS_EX_COMPOSITED, so always do this in our OnPaint(), even if we
don't need to draw anything ourselves.

This allows to avoid disabling WS_EX_COMPOSITED when wxListCtrl is used,
which resulted in horrible flicker before.

See wxWidgets#23585.
@petebannister
Copy link

petebannister commented Aug 30, 2023

wxAutoBufferedPaintDC can cause very slow rendering if drawing bitmaps with alpha on MSW. Not sure if this really needs a separate bug report?
The reason is that the backing store bitmap used by wxAutoBufferedPaintDC is a DDB and not a DIB. If you draw an alpha bitmap onto the DC then AlphaBlt will use wxAlphaPixelData which when not using a DIB will make a copy of the whole backing store. It does this for each bitmap draw (can be pretty bad on wxAuiToolBar).
I've worked around it by making my own double buffering solution that uses this:

            // Convert to DIB.  This way, if transparent images are drawn then 
            // you do not get a DDB=>DIB=>DDB conversion via temporary
            // expensive resource allocations!
            store.ConvertToDIB();

Thats meant I have to derive wxAuiToolBar and re-implement OnPaint. Would be nice to be able to avoid doing that.

@vadz
Copy link
Contributor

vadz commented Aug 31, 2023

@petebannister With which wx version do you see this? In 3.3, wxAutoBufferedPaintDC shouldn't do any buffering.

@petebannister
Copy link

Ah ok - in 3.2.2.1

@vadz
Copy link
Contributor

vadz commented Aug 31, 2023

I've extracted this into a separate issue then as this one is explicitly about 3.3.

OTOH this one might be fixed by now, at least the wxListCtrl part should be.

@kfsone Can you provide a simple way to reproduce the problem with flickering?

arch1t3cht added a commit to arch1t3cht/Aegisub that referenced this issue Dec 26, 2023
See wxWidgets/wxWidgets#23585 .
This patch reverts commit fb4f0b590c42a66263debf926617c00b157c9a in
wxWidgets.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
MSW regression Worked previously, doesn't work any longer
Projects
None yet
Development

No branches or pull requests

3 participants