improve:墨迹渲染
This commit is contained in:
@@ -900,12 +900,13 @@ namespace Ink_Canvas
|
|||||||
|
|
||||||
bool InkToShapeProcess()
|
bool InkToShapeProcess()
|
||||||
{
|
{
|
||||||
var engineMode = ShapeRecognitionRouter.FromSettingsInt(Settings.InkToShape.ShapeRecognitionEngine);
|
// WinRT 与非 WinRT 均延后到 Dispatcher 上异步执行:在 StrokeCollected 内对
|
||||||
if (ShapeRecognitionRouter.ResolveUseWinRt(engineMode))
|
// InkToShapeProcessCoreAsync 同步 GetResult() 会长时间阻塞 UI 线程(抬笔卡顿);
|
||||||
{
|
// WinRT 路径若同步等待还可能与贴回 UI 的延续死锁(见类注释 InkToShapeSerial)。
|
||||||
var strokeHw = strokeForHandwritingBeautify;
|
var strokeHw = strokeForHandwritingBeautify;
|
||||||
var preBrushHwPts = preBrushHandwritingPoints;
|
var preBrushHwPts = preBrushHandwritingPoints;
|
||||||
var wsTail = wasStraightened;
|
var wsTail = wasStraightened;
|
||||||
|
// ApplicationIdle:在更高优先级(布局/输入/本帧渲染)之后执行,减轻抬笔瞬间主线程“顶死”感。
|
||||||
Dispatcher.BeginInvoke(new Action(async () =>
|
Dispatcher.BeginInvoke(new Action(async () =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
@@ -919,24 +920,10 @@ namespace Ink_Canvas
|
|||||||
{
|
{
|
||||||
System.Diagnostics.Debug.WriteLine(ex);
|
System.Diagnostics.Debug.WriteLine(ex);
|
||||||
}
|
}
|
||||||
}), DispatcherPriority.Normal);
|
}), DispatcherPriority.ApplicationIdle);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
InkToShapeProcessCoreAsync().GetAwaiter().GetResult();
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
System.Diagnostics.Debug.WriteLine(ex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Settings.InkToShape.EnableWinRtHandwritingStrokeBeautify)
|
|
||||||
ScheduleHandwritingGlyphReplaceAfterStrokeCollected(strokeForHandwritingBeautify, isBoardBrushStroke, preBrushHandwritingPoints);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (InkToShapeProcess())
|
if (InkToShapeProcess())
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user