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

windows feature WS_EX_NOREDIRECTIONBITMAP #575

Merged

Conversation

ekicyou
Copy link
Contributor

@ekicyou ekicyou commented Jun 19, 2018

  • Tested on all platforms changed
  • Added an entry to CHANGELOG.md if knowledge of this change could be valuable to users
  • Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
  • Created an example program if it would help users understand this functionality

Windows additionally has WindowBuilderExt::with_no_redirection_bitmap.
In order to use Direct Composition API, implemented the function to set WS_EX_NOREDIRECTIONBITMAP extended attribute.

ref: MSDN Windows with C++ - High-Performance Window Layering Using the Windows Composition Engine

@@ -55,6 +55,9 @@ pub trait WindowBuilderExt {

/// This sets `ICON_BIG`. A good ceiling here is 256x256.
fn with_taskbar_icon(self, taskbar_icon: Option<Icon>) -> WindowBuilder;

/// This sets `WS_EX_NOREDIRECTIONBITMAP`.
fn with_no_redirection_bitmap(self) -> WindowBuilder;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's conventional for builder methods to take a bool, for more flexibility.

@francesca64
Copy link
Member

Well, I don't really know how to test this, since it just makes my OpenGL app transparent.

My only question is if this is mutually exclusive with with_transparency. Having both made the client area black.

@ekicyou
Copy link
Contributor Author

ekicyou commented Jun 21, 2018

My only question is if this is mutually exclusive with with_transparency. Having both made the client area black.

Excuse my translation.

It becomes exclusive designation.

Both can be used as a means to realize a transparent window, but the realization method is different.

WS_EX_NOREDIRECTIONBITMAP specifies not to display the GDI bitmap.
The GDI bitmap is the old rendering API, not GPU optimized.
By using only composition surfaces directly managed by DWM for screen display, you can intercept maximum GPU optimization of Windows.

As a composition surface, you can specify a swap chain.

I am sorry, I can not prepare a small sample now.
The trial at hand is in trial with the modification of [servo/webrender].

@francesca64
Copy link
Member

It would be good if enabling this caused the call to DwmEnableBlurBehindWindow to be skipped, since then there wouldn't be any bad interactions. Other than that, looks good.

@ekicyou
Copy link
Contributor Author

ekicyou commented Jun 22, 2018

Thank you. Check the source and fix it.

@francesca64
Copy link
Member

Alright, looks great.

@francesca64 francesca64 merged commit 047c67b into rust-windowing:master Jun 22, 2018
@ekicyou ekicyou deleted the feature/WS_EX_NOREDIRECTIONBITMAP branch June 22, 2018 03:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

2 participants