iOS/macOS no longer need a whole display link just for a one-shot refresh
This commit is contained in:
Родитель
bc6ec734f1
Коммит
60832d0e87
|
@ -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();
|
||||
|
|
Загрузка…
Ссылка в новой задаче