浏览代码

Merge pull request #119 from Unity-Technologies/zxw/opt_il2cpp_compile

Zxw/opt il2cpp compile
/siyaoH-1.17-PlatformMessage
GitHub 3 年前
当前提交
684feb09
共有 6 个文件被更改,包括 2529 次插入2510 次删除
  1. 91
      com.unity.uiwidgets/Runtime/material/animated_icons/animated_icons.cs
  2. 992
      com.unity.uiwidgets/Runtime/material/animated_icons/data/add_event.g.cs
  3. 986
      com.unity.uiwidgets/Runtime/material/animated_icons/data/arrow_menu.g.cs
  4. 986
      com.unity.uiwidgets/Runtime/material/animated_icons/data/close_menu.g.cs
  5. 992
      com.unity.uiwidgets/Runtime/material/animated_icons/data/ellipsis_search.g.cs
  6. 992
      com.unity.uiwidgets/Runtime/material/animated_icons/data/event_add.g.cs

91
com.unity.uiwidgets/Runtime/material/animated_icons/animated_icons.cs


using System.Collections.Generic;
using Unity.UIWidgets.animation;
using Unity.UIWidgets.foundation;
using Unity.UIWidgets.ui;

using Color = Unity.UIWidgets.ui.Color;
/**
* In the animated icon data files, we have made some changes to optimize the compilation speed for il2cpp
* Specifically, we change all instance of Offsets to 2 separate floats throughout the file
*
* In this file, we change the codes a bit to support these changes. Please think twice and test on the Gallery sample
* if you want to make further changes here
*/
public static T _interpolate<T>(T[] values, float progress, _Interpolator<T> interpolator) {
public static float _interpolate(float[] values, float progress) {
if (values.Length == 1) {
if (values.Length == 2) {
float targetIdx = MathUtils.lerpNullableFloat(0, values.Length - 1, progress);
float targetIdx = Mathf.Lerp(0, values.Length - 1, progress);
return interpolator(values[lowIdx], values[highIdx], t);
return Mathf.Lerp(values[lowIdx], values[highIdx], t);
}
public static void _interpolateOffset(float[] values, float progress, ref float x, ref float y) {
D.assert(progress <= 1.0f);
D.assert(progress >= 0.0f);
D.assert(values.Length % 2 == 0);
if (values.Length == 2) {
x = values[0];
y = values[1];
return;
}
float targetIdx = Mathf.Lerp(0, values.Length / 2 - 1, progress);
int lowIdx = targetIdx.floor();
int highIdx = targetIdx.ceil();
float t = targetIdx - lowIdx;
x = Mathf.Lerp(values[lowIdx * 2], values[highIdx * 2], t);
y = Mathf.Lerp(values[lowIdx * 2 + 1], values[highIdx * 2 + 1], t);
}
}

}
}
struct _PathOffset {
public float dx;
public float dy;
public _PathOffset(float x, float y) {
dx = x;
dy = y;
}
public static _PathOffset lerp(_PathOffset a, _PathOffset b, float t) {
return new _PathOffset(Mathf.Lerp(a.dx, b.dx, t), Mathf.Lerp(a.dy, b.dy, t));
}
}
class _PathFrames {
public _PathFrames(
_PathCommand[] commands,

public readonly float[] opacities;
public void paint(Canvas canvas, Color color, _UiPathFactory uiPathFactory, float progress) {
float opacity = AnimatedIconUtils._interpolate<float>(opacities, progress, MathUtils.lerpNullableFloat);
float opacity = AnimatedIconUtils._interpolate(opacities, progress);
Paint paint = new Paint();
paint.style = PaintingStyle.fill;
paint.color = color.withOpacity(color.opacity * opacity);

}
class _PathMoveTo : _PathCommand {
public _PathMoveTo(Offset[] points) {
public _PathMoveTo(float[] points) {
public readonly Offset[] points;
public readonly float[] points;
Offset offset = AnimatedIconUtils._interpolate<Offset>(points, progress, Offset.lerp);
path.moveTo(offset.dx, offset.dy);
float dx = 0f, dy = 0f;
AnimatedIconUtils._interpolateOffset(points, progress, ref dx, ref dy);
path.moveTo(dx, dy);
public _PathCubicTo(Offset[] controlPoints1, Offset[] controlPoints2, Offset[] targetPoints) {
public _PathCubicTo(float[] controlPoints1, float[] controlPoints2, float[] targetPoints) {
public readonly Offset[] controlPoints2;
public readonly Offset[] controlPoints1;
public readonly Offset[] targetPoints;
public readonly float[] controlPoints2;
public readonly float[] controlPoints1;
public readonly float[] targetPoints;
Offset controlPoint1 = AnimatedIconUtils._interpolate<Offset>(controlPoints1, progress, Offset.lerp);
Offset controlPoint2 = AnimatedIconUtils._interpolate<Offset>(controlPoints2, progress, Offset.lerp);
Offset targetPoint = AnimatedIconUtils._interpolate<Offset>(targetPoints, progress, Offset.lerp);
float dx1 = 0f, dy1 = 0f, dx2 = 0f, dy2 = 0f, dx = 0f, dy = 0f;
AnimatedIconUtils._interpolateOffset(controlPoints1, progress, ref dx1, ref dy1);
AnimatedIconUtils._interpolateOffset(controlPoints2, progress, ref dx2, ref dy2);
AnimatedIconUtils._interpolateOffset(targetPoints, progress, ref dx, ref dy);
controlPoint1.dx, controlPoint1.dy,
controlPoint2.dx, controlPoint2.dy,
targetPoint.dx, targetPoint.dy
dx1, dy1,
dx2, dy2,
dx, dy
public _PathLineTo(Offset[] points) {
public _PathLineTo(float[] points) {
Offset[] points;
float[] points;
Offset point = AnimatedIconUtils._interpolate<Offset>(points, progress, Offset.lerp);
path.lineTo(point.dx, point.dy);
float dx = 0f, dy = 0f;
AnimatedIconUtils._interpolateOffset(points, progress, ref dx, ref dy);
path.lineTo(dx, dy);
}
}

992
com.unity.uiwidgets/Runtime/material/animated_icons/data/add_event.g.cs
文件差异内容过多而无法显示
查看文件

986
com.unity.uiwidgets/Runtime/material/animated_icons/data/arrow_menu.g.cs
文件差异内容过多而无法显示
查看文件

986
com.unity.uiwidgets/Runtime/material/animated_icons/data/close_menu.g.cs
文件差异内容过多而无法显示
查看文件

992
com.unity.uiwidgets/Runtime/material/animated_icons/data/ellipsis_search.g.cs
文件差异内容过多而无法显示
查看文件

992
com.unity.uiwidgets/Runtime/material/animated_icons/data/event_add.g.cs
文件差异内容过多而无法显示
查看文件

正在加载...
取消
保存