Weird rendering problem

Having problems with building or using the CefGlue .NET/Mono binding? Ask your questions here.

Moderator: fddima

Weird rendering problem

Postby JohnConnor » Fri Aug 04, 2017 7:10 am

Hello,,

I am using CefGlue version 57.1.0.0.
Recently started to encounter problems with renderer, that it somehow receives bad/distorted buffer to render.
For now I am only saving this to image file. (You can see the result comparison of good and bad images).
This happens when I have 2 tabs and render one tab to image and then another one. Corruption rate is ~33% (meaning that 1/3 images gets distorted).

Image

The code to save the images is pretty straightforward:


Code: Select all
public void ScreenShot(int width, int height, IntPtr buffer, string destination)
{
    var rect = new Rectangle(0, 0, width, height);
    var windowBitmap = new Bitmap(width, height);

    try
    {
        var screenShot = windowBitmap.LockBits(rect, ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
        var totalSize = screenShot.Stride * screenShot.Height;
        var temporaryBuffer = new byte[totalSize];
        var screenShotPtr = screenShot.Scan0;
        Marshal.Copy(buffer, temporaryBuffer, 0, totalSize);
        Marshal.Copy(temporaryBuffer, 0, screenShotPtr, totalSize);
        windowBitmap.UnlockBits(screenShot);
        windowBitmap.Save(destination);
    }
}


Some additional info to this. It only happens when I run few instances of the same process that used same CEF files. I also suspected that window size is somehow set incorrectly and it turns out to be the case. I've attached multiple logs into console in my app from various events and noticed that even after I fill up the CefScreenInfo object in GetScreenInfo method - latter during the OnPaint in RenderHandler I am receiveing old values that were supposed to be changed.
here is short log from the console:
Image



Any thoughts on what I might be doing wrong would be appreciated.

Thanks!
J
Last edited by JohnConnor on Tue Aug 08, 2017 9:06 am, edited 1 time in total.
JohnConnor
Techie
 
Posts: 21
Joined: Tue Mar 21, 2017 2:27 am

Re: Weird rendering problem

Postby JohnConnor » Mon Aug 07, 2017 6:57 am

I guess terminator will win this time ;]
JohnConnor
Techie
 
Posts: 21
Joined: Tue Mar 21, 2017 2:27 am


Return to CefGlue Forum

Who is online

Users browsing this forum: No registered users and 27 guests