ClientOSRenderer::OnPaint Branch 1650 vs 2062

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.

ClientOSRenderer::OnPaint Branch 1650 vs 2062

Postby Marcin » Tue Nov 25, 2014 8:43 am

Hi,

I was using 1650 branch until October and then I migrated to 2062 with the new OSR rendering engine. Everything worked fine on my dev machine (Windows 8.1), (BTW I appreciate FPS limit!!!), however when I tried to test the soft on old Win XP I have an exception.

It is related to the way I use the buffer received in OnPaint.

As I cannot draw the bitmap during OnPaint I need to do it once the rendering engine I use is calling my Render callback and provides me a viewport I can draw into. It means I am using bitmapbits accross those two separate callback. In fact I use GDI DrawBitmap with the buffer received in OnPaint. In 1650 it worked perfect. The problem with 2062 is that on Windows 8.1 and fast machine (if it matters) the memory refered by bitmap was accesible in my rendering callback, while on Windows XP the memory was no longer accesible that resulted in the execption when calling GDI DrawBitmap ...

Could you explain me what was changes in this matter compared to 1650 branch and why it works with W8.1 and not XP ?

many thanks in advance

Marcin
Marcin
Techie
 
Posts: 37
Joined: Fri Dec 06, 2013 5:07 am

Re: ClientOSRenderer::OnPaint Branch 1650 vs 2062

Postby magreenblatt » Tue Nov 25, 2014 12:12 pm

The buffer passed to OnPaint should not be referenced outside of the OnPaint callback. You should either use it in the OnPaint callback or make a copy.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: ClientOSRenderer::OnPaint Branch 1650 vs 2062

Postby Marcin » Wed Nov 26, 2014 12:02 pm

Copying was what I did in the first place in 1650 branch, however as I was looking for performance improvement I noticed, the buffer is stable across those two callback (memory address changes sometimes, but is always accessible), so I created GDI::bitmap object with mapped buffer and used Graphics->DrawBitmap. It worked well on every machine and system. With the new 2062, it works under Windows 8.1 but not on slow XP and that makes me curious why !

In 1650 it was also recommended to use buffer only in OnPaint() though I have not crossed any problems with using it outside, so my question is what has changed and why it's ok on W8 and not XP ? If I will understand the reason behind different behaviour under W8 and my XP I might use directly the buffer in W8 and copy memory in XP ....
Marcin
Techie
 
Posts: 37
Joined: Fri Dec 06, 2013 5:07 am

Re: ClientOSRenderer::OnPaint Branch 1650 vs 2062

Postby magreenblatt » Wed Nov 26, 2014 1:50 pm

Marcin wrote:In 1650 it was also recommended to use buffer only in OnPaint() though I have not crossed any problems with using it outside, so my question is what has changed and why it's ok on W8 and not XP ?

Probably one platform is using hardware rendering and the other is using software rendering. In any case you're depending on an internal implementation detail -- don't do that.
magreenblatt
Site Admin
 
Posts: 12382
Joined: Fri May 29, 2009 6:57 pm

Re: ClientOSRenderer::OnPaint Branch 1650 vs 2062

Postby Marcin » Thu Nov 27, 2014 6:25 am

ok, thanks
Marcin
Techie
 
Posts: 37
Joined: Fri Dec 06, 2013 5:07 am


Return to Support Forum

Who is online

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