Welcome Guest Search | Active Topics | Sign In | Register

Paint event on WebControl/WebView: possible to detect when WebView area is updated? Options
trash1
Posted: Friday, October 16, 2015 2:39:50 AM
Rank: Newbie
Groups: Member

Joined: 10/3/2015
Posts: 5
I'm trying to find out how to detect when WebControl/WebView is repainted, preferably with the region that was/needs to be repainted.

I've been using WebView.Capture(Rectangle) method to capture part of the rendered page, but I failed to find a way to detect when the rendered page updates and I need to do WebView.Capture again to get the updated image.

Is this somehow possible to detect when the page in WebView/WebControl is re-rendered or somehow subscribe for something like a 'Paint' event?
eo_support
Posted: Friday, October 16, 2015 2:49:32 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

This is not possible. Currently there is no event for capturing rendering changes. Sorry about it!

Thanks!
trash1
Posted: Friday, October 16, 2015 2:52:40 AM
Rank: Newbie
Groups: Member

Joined: 10/3/2015
Posts: 5
Thats sad (
And how is it done in WebView/WebControl? Is it rerendered by some event from chrome/webkit or is it just being polled with some frequency by a timeout maybe, and then blit to WebControl hwnd?
eo_support
Posted: Friday, October 16, 2015 2:55:43 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

The whole rendering is done by the chrome browser engine. We do not do blit on top of that.

Thanks!
trash1
Posted: Friday, October 16, 2015 3:00:32 AM
Rank: Newbie
Groups: Member

Joined: 10/3/2015
Posts: 5
So if I'm getting it correct, you do something like give a hwnd of window to paint to to the chrome engine, and it does the blitting to that hwnd when its necessary? Thats the reason for not having a way to detect when the paint from chrome engine has happened?
eo_support
Posted: Friday, October 16, 2015 3:08:53 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Yes. That is correct. The actual process also involves GPU so it's actually a very complicated process. Rendering performance is extremely important for a browser engine so it's highly optimized and there are multiple steps in the pipe line that works asynchrnously on each step. So there is no single place of "paint" event to start with.
trash1
Posted: Friday, October 16, 2015 3:27:16 AM
Rank: Newbie
Groups: Member

Joined: 10/3/2015
Posts: 5
I'm planning to use html to render ui that will be overlayed onto my WinForm app.
I was about to create one webpage that would draw a few (3 for example) ui panels containing necessary ui for my app. I was going to take regions from the rendered html page, belonging to those panels, and draw them onto my form at specific places. For example, I'll define a 100x200 px panel at coords (0, 0) on a webpage, and draw it in 100x200 rectangle at some coords on my form.
I can do that using WebView.Capture method, but I didn't find a way to detect when changes are rendered, so I could Capture and blit onto my form after something is rerendered.
I could use 3 separate WebControls/WebViews, one for each panel on a separate page, but I'm worried about that being a huge overhead and very resource-consuming for rendering just a few 100x200 divs at different places on my form.

How much resources is actually usually consumed by one WebView/WebControl?
Maybe you have any idea/hint how I could achieve the following functionality?
eo_support
Posted: Friday, October 16, 2015 9:16:10 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Hi,

You should use three WebView instead. Each WebView does consume additional resources, however the resource is related to the complexity of your page. So if you just use it display simple DIVs, then it should consume much. That's the straight forward way of doing things. Capture is not designed to provide real time update. So you will run into more problems with that approach.

Thanks!
trash1
Posted: Friday, October 16, 2015 2:02:49 PM
Rank: Newbie
Groups: Member

Joined: 10/3/2015
Posts: 5
I have checked memory consumption and spawned processes:

With one WebControl on my form my app spawns 4 child rundll32.exe processes, which take a total of ~240mb RAM.
With each additional WebControl on my form, it spawns another rundll32.exe child process which takes ~83mb RAM.

So I guess sacrificing 406mb of RAM for just 3 divs is a bit more than one would expect. I am not sure how many such panels I would need and with just 10 of them it would take 1070mb RAM.

Why do you think Capture would work bad for real time updates?
eo_support
Posted: Friday, October 16, 2015 2:43:02 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,229
Because that's not what it is designed to do. Capture is designed for you to take a snapshot of the current rendering output (it copies from the GPU frame buffer) and that's it. It is slow in term of performance (comparing with direct GPU buffer manupulating) and it has no notification/update mechanism as you have already found out. It is also unpredicatble in nature in term of the amount of time it would take. For example, if GPU is busy updating the screen thus locks the frame buffer, then the capture feature has to wait since getting the output to screen in time is a bigger priority for the rendering engine. In another word, capture does not give consideration of any special requirement a real time screen update scenario would need.

Of course, the final judge is whatever works --- so if your test shows that it works just fine in your case then I suppose you can just use it. But if you run into any trouble you would be pretty much on your own. We won't try to "fix" a feature to make it do what is it is not designed to do.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.