CefBrowserHost::Invalidate() only part of screen??

Having problems with building or using CEF's C/C++ APIs? This forum is here to help. Please do not post bug reports or feature requests here.

Re: CefBrowserHost::Invalidate() only part of screen??

Postby fddima » Sat Apr 22, 2017 1:01 pm

chanman, rendering process going absolutely asynchronous to any part of client code. Actually different renders can be used: GPU and software renderer. And dirtyRects in current impl has updated region. For software rendering it is always show updated region, usually rounded to composition layers (256/512px squares). For GPU rendering i'm not sure which bounds provided. Also CEF maintains own pixelbuffer (and provides pointer to it in OnPaint call). Invalidate call queue task to call OnPaint correctly to push CEF-maintained pixelbuffer to client. Also if you throttle framerate - dirtyRect will be expanded (i.e. update left-top and right-bottom pixel will cause full buffer update, not a two rects.)

So... if you don't want to update full surface - you CAN read any region from provided pixel buffer. For example set flag + interesting region, call Invalidate. OnPaint consumes flag+region. Of course whenever address of pixelbuffer changed or dimensions changed - this is will be full update in all cases. Note, that "erase background" when view size changed also appears in OnPaint and in most cases it is not interested.

In any way: if it is video - fast updates => should be ok to catch only portion of buffer.
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: CefBrowserHost::Invalidate() only part of screen??

Postby chanman » Sat Apr 22, 2017 5:52 pm

fddima wrote:So... if you don't want to update full surface - you CAN read any region from provided pixel buffer. For example set flag + interesting region, call Invalidate. OnPaint consumes flag+region.


This is an interesting approach, how would I differentiate between these two situations:

Situation 1:

- Set a flag saying I only want to repaint a 100x100 region
- I call CEF invalidate
- CEF thread calls OnPaint (with dirtyRects = full screen, because you can't invalidate part of the screen)
- Desired behavior is to only repaint the 100x100 region

Situation 2:
- Set a flag saying I only want to repaint a 100x100 region
- I call CEF Invalidate
- At the same time, the user took some browser-based action which needs a full repaint, so CEF also does a full invalidate separately
- CEF thread calls OnPaint (with dirtyRects = full screen, because you can't invalidate part of the screen)
- Desired behavior is to repaint the whole screen

Because I have no control over the CEF Invalidate/Onpaint loop, thread and parameters, I cannot tell what the proper behavior is.
chanman
Newbie
 
Posts: 6
Joined: Thu Apr 20, 2017 1:42 pm

Re: CefBrowserHost::Invalidate() only part of screen??

Postby fddima » Sat Apr 22, 2017 6:17 pm

chanman, as you ask good questions - you already feel that there is no way to determine this precisely. So if you no see way for heuristic... may be is no way.

On other side: you ask to invalidate only portion of pixel buffer. Who guarantee that you pass correct coords? I mean, when you call Invalidate(rect) - user can scroll down and your rect actually will be incorrect.

So, i'm doesnt see how invalidate with rect can actually help. Result will be really about same as proposed by me with flag, except that with flag you really can't distinguish own request from framework request. But even if you can distinguish - nothing will prevent this sequence:
1. Invalidate(rect)
2. OnPaint caused by view resize (new pixbuf, new dimensions) (or full repaint by user scroll)
3. OnPaint from Invalidate call - rect is trash now

4. Normally nothing should prevent merge 2) and 3) in one OnPaint call. With framerate limiter - is likely what should happens.

Well. May be your request have sense. But it is still very unclear how it can help in reality. So... sorry, no have answer for your question. :(
fddima
Master
 
Posts: 788
Joined: Tue Dec 07, 2010 6:10 am

Re: CefBrowserHost::Invalidate() only part of screen??

Postby NickChapman » Wed May 18, 2022 10:02 pm

Hello,
I would also like to be able to invalidate just part of the screen.
NickChapman
Techie
 
Posts: 21
Joined: Sun Apr 24, 2022 2:42 am

Previous

Return to Support Forum

Who is online

Users browsing this forum: Google [Bot] and 73 guests