未验证 提交 95c3da03 编写于 作者: L lindexi 提交者: GitHub

Using `Array.Copy` to make array copy faster in StylusPointCollection (#5217)

* Using `Array.Copy` to make array copy faster in StylusPointCollection

* Using Span to improve performance
上级 3ccd6f55
......@@ -195,17 +195,14 @@ internal StylusPointCollection(StylusPointDescription stylusPointDescription, in
if (dataLength > 0)
{
//copy the rest of the data
data = new int[dataLength];
for (int localIndex = 0, rawArrayIndex = i + startIndex; localIndex < data.Length; localIndex++, rawArrayIndex++)
{
data[localIndex] = rawPacketData[rawArrayIndex];
}
var rawArrayStartIndex = i + startIndex;
data = rawPacketData.AsSpan(rawArrayStartIndex, dataLength).ToArray();
}
StylusPoint newPoint = new StylusPoint(p.X, p.Y, StylusPoint.DefaultPressure, _stylusPointDescription, data, false, false);
if (containsTruePressure)
{
//use the algoritm to set pressure in StylusPoint
//use the algorithm to set pressure in StylusPoint
int pressure = rawPacketData[i + 2];
newPoint.SetPropertyValue(StylusPointProperties.NormalPressure, pressure);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册