void renderHandler_OnPaint(object sender, Chromium.Event.CfxOnPaintEventArgs e)
 {
     if (image != null && e.Width == width && e.Height == height && FEnabledIn[0])
     {
         lock (bLock)
         {
             unsafe
             {
                 fixed(byte *p = image)
                 {
                     memcpy((IntPtr)p, e.Buffer, (UIntPtr)(width * height * 4));
                 }
             }
             isImageReady = true;
         }
     }
 }
Beispiel #2
0
 void renderHandler_OnPaint(object sender, Chromium.Event.CfxOnPaintEventArgs e)
 {
     lock (pbLock)
     {
         if (pixelBuffer == null || pixelBuffer.Width < e.Width || pixelBuffer.Height < e.Height)
         {
             pixelBuffer = new Bitmap(e.Width, e.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
         }
         using (var bm = new Bitmap(e.Width, e.Height, e.Width * 4, System.Drawing.Imaging.PixelFormat.Format32bppArgb, e.Buffer))
         {
             using (var g = Graphics.FromImage(pixelBuffer))
             {
                 g.DrawImageUnscaled(bm, 0, 0);
             }
         }
     }
     foreach (var r in e.DirtyRects)
     {
         Invalidate(new Rectangle(r.X, r.Y, r.Width, r.Height));
     }
 }