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
Create Snapshot using Bitblt #2286
Comments
Hi, I wrote the gist but unfortunately I haven't had time to upgrade to 63 yet. Do you know if the problem also occurs in a pure WinForms environment? If you have another gist that works specifically in a WinForms+WPF hosted environment I'd be happy to link to it from my gist. |
Hi, thank you for your reply. Sorry, I am not aware whether bitblt works in pure winforms application. Unfortunately neither the bitblt nor the printwindow approach work with the new version. I can add the implementation to the minimal example in the next days |
so, I've added a basic implementation for using printwindow in my example fork. |
Thank you for your reply. |
Have the same problem after update 57->63 in WinForms application. Snapshot per BitBlt with version 57 works fine, with version 63 black. |
In general, the only time I remember black screens is when the window or control isn't visible (as you describe with @803617 Would be helpful if you showed your code, I've been using |
@chylex Well , BitBlt isn't working either when the form is visible :( |
My test project creates this black snapshot for me. |
Here's my WinForms code, maybe it'll help. I'm calling it with the Form handle, the Form is visible but outside all monitors, if you need to simulate invisible forms. |
@chylex Thank you for sharing your code. That's exactly the same code I am using. Do you set any specific cef settings or any cmd line args for cef? Could you share them? |
Nothing that should affect BitBlt, afaik. I'm on CefSharp 64.0.0-CI2508 with legacy JS binding, so it should be consistent with previous versions. The code has been working since 55, and only had minor changes (like screenshoting window border, which was then removed when I decided to move the screenshotted Form outside all monitors where borders aren't rendered). |
BitBlt works, if I disable the gpu of course. I'm wondering if there are any other cmd line args you are using @chylex ? |
By default, only |
Unfortunately those args did not change anything. I did some research and I've found a PR on bitbucket for CEF: https://bitbucket.org/chromiumembedded/cef/pull-requests/96/osr-fix-gpu-cpu-readback-performance/diff I am not aware of any side effects by using this argument. |
Description for use-angle switch: Select which ANGLE backend to use. Options are: default: Attempts several ANGLE renderers until one successfully initializes, varying ES support by platform. d3d9: Legacy D3D9 renderer, ES2 only. d3d11: D3D11 renderer, ES2 and ES3. warp: D3D11 renderer using software rasterization, ES2 and ES3. gl: Desktop GL renderer, ES2 and ES3. gles: GLES renderer, ES2 and ES3. |
use-angle did not work on different environments. Especially with intel HD graphiccards BitBlt did not work. We tested the following settings and until now it is working like a charm: |
@Ratcha9 Thanks for posting your workaround 👍
https://www.chromium.org/developers/design-documents/gpu-accelerated-compositing-in-chrome
https://cs.chromium.org/chromium/src/gpu/config/software_rendering_list.json As a general note, making sure you have the latest graphics drivers, if you look at the Closing as this isn't a bug in |
What version of the product are you using?
Nuget Package 63.0.1
What architecture x86 or x64?
x64
On what operating system?
Windows10
Are you using
WinForms
,WPF
orOffScreen
?WinForms component in WPF application
What steps will reproduce the problem?
I've pushed an example to MinimalExample. There I've modified the WPF proj:
Removed WPF CefSharp Browser
Winforms CefSharp browser added
Button added on top
A click on the button creates a Bitmap with the recommended gist and shows the image in a new window.
Since the update to version 63.0.1 I am getting a black image. With version 57.0 it is working fine
What is the expected output? What do you see instead?
Expectation: screenshot of the browser content
Actual result: black bitmap
Please provide any additional information below.
In my real wpf application I am using Bitblt and PrintWindow. In order to mitigate the airspace issue, while we are showing e.g. modal dialogs "above" the browser, we hide the winforms hwnd, take pictures of it with PrintWindow and render that bitmap in WPF. This hacky workaround was pretty useful, since it worked with about 7-30 fps. I can reimplement this in the example, if it would help
The text was updated successfully, but these errors were encountered: