iOS/macOS no longer need a whole display link just for a one-shot refresh

This commit is contained in:
Matthew Leibowitz 2017-06-01 15:31:42 -05:00
Родитель bc6ec734f1
Коммит 60832d0e87
2 изменённых файлов: 24 добавлений и 8 удалений

Просмотреть файл

@ -42,18 +42,26 @@ namespace SkiaSharp.Views.Forms
if (!oneShot && !Element.HasRenderLoop)
return;
// if this is a one shot request, don't bother with the display link
if (oneShot)
{
var nativeView = Control;
nativeView?.Display();
return;
}
// create the loop
displayLink = new CVDisplayLink();
displayLink.SetOutputCallback(delegate
{
var formsView = Control;
var nativeView = Element;
var nativeView = Control;
var formsView = Element;
// redraw the view
formsView?.Display();
nativeView?.Display();
// stop the render loop if this was a one-shot, or the views are disposed
if (formsView == null || nativeView == null || !nativeView.HasRenderLoop)
if (nativeView == null || formsView == null || !formsView.HasRenderLoop)
{
displayLink.Stop();
displayLink.Dispose();

Просмотреть файл

@ -46,17 +46,25 @@ namespace SkiaSharp.Views.Forms
if (!oneShot && !Element.HasRenderLoop)
return;
// if this is a one shot request, don't bother with the display link
if (oneShot)
{
var nativeView = Control;
nativeView?.Display();
return;
}
// create the loop
displayLink = CADisplayLink.Create(() =>
{
var formsView = Control;
var nativeView = Element;
var nativeView = Control;
var formsView = Element;
// redraw the view
formsView?.Display();
nativeView?.Display();
// stop the render loop if this was a one-shot, or the views are disposed
if (formsView == null || nativeView == null || !nativeView.HasRenderLoop)
if (nativeView == null || formsView == null || !formsView.HasRenderLoop)
{
displayLink.Invalidate();
displayLink.Dispose();