WPF - Resize Glitches (Image glitches during resize)

- WritableBitmapRenderHandler/InteropBitmapRenderHandler ignore update if size doesn't match

It's possible that OnPaint is called multiple times before our BeginInvoke call is marshalled onto the UI Thread.
In those cases we check width/height and ignore the call if it doesn't match

Issue #3114
This commit is contained in:
amaitland
2020-10-30 14:28:01 +10:00
parent c2e343e23d
commit b24efd2853
2 changed files with 24 additions and 0 deletions
@@ -67,6 +67,18 @@ namespace CefSharp.Wpf.Rendering
return;
}
var size = isPopup ? popupSize : viewSize;
//If OnPaint is called multiple times before
//our BeginInvoke call we check the size matches our most recent
//update, the buffer has already been overriden (frame is dropped effectively)
//so we ignore this call
//https://github.com/cefsharp/CefSharp/issues/3114
if (size.Width != width || size.Height != height)
{
return;
}
if (createNewBitmap)
{
if (image.Source != null)
@@ -83,6 +83,18 @@ namespace CefSharp.Wpf.Rendering
return;
}
var size = isPopup ? popupSize : viewSize;
//If OnPaint is called multiple times before
//our BeginInvoke call we check the size matches our most recent
//update, the buffer has already been overriden (frame is dropped effectively)
//so we ignore this call
//https://github.com/cefsharp/CefSharp/issues/3114
if (size.Width != width || size.Height != height)
{
return;
}
if (createNewBitmap)
{
if (image.Source != null)