Browse Source

Return a frame even for an empty control.

If the user has a control with no content then we've still got a valid control
so return a frame with size 0.
pull/2307/head
Steven Kirk 8 years ago
parent
commit
2b34a27892
  1. 13
      src/Avalonia.Controls/Remote/Server/RemoteServerTopLevelImpl.cs

13
src/Avalonia.Controls/Remote/Server/RemoteServerTopLevelImpl.cs

@ -270,11 +270,15 @@ namespace Avalonia.Controls.Remote.Server
var bpp = fmt == ProtocolPixelFormat.Rgb565 ? 2 : 4;
var data = new byte[width * height * bpp];
var handle = GCHandle.Alloc(data, GCHandleType.Pinned);
try
{
_framebuffer = new LockedFramebuffer(handle.AddrOfPinnedObject(), new PixelSize(width, height), width * bpp, _dpi, (PixelFormat)fmt,
null);
Paint?.Invoke(new Rect(0, 0, width, height));
if (width > 0 && height > 0)
{
_framebuffer = new LockedFramebuffer(handle.AddrOfPinnedObject(), new PixelSize(width, height), width * bpp, _dpi, (PixelFormat)fmt,
null);
Paint?.Invoke(new Rect(0, 0, width, height));
}
}
finally
{
@ -306,8 +310,7 @@ namespace Avalonia.Controls.Remote.Server
return;
}
if (ClientSize.Width < 1 || ClientSize.Height < 1)
return;
var format = ProtocolPixelFormat.Rgba8888;
foreach(var fmt in _supportedFormats)
if (fmt <= ProtocolPixelFormat.MaxValue)

Loading…
Cancel
Save