浏览代码

fix path metric crash issue

/zxw-fix_path_metric_crash
Xingwei Zhu 3 年前
当前提交
f1051113
共有 1 个文件被更改,包括 10 次插入10 次删除
  1. 20
      com.unity.uiwidgets/Runtime/ui/painting.cs

20
com.unity.uiwidgets/Runtime/ui/painting.cs


public float length(int contourIndex) {
D.assert(contourIndex <= currentContourIndex, () => $"Iterator must be advanced before index {contourIndex} can be used.");
return PathMeasure_length(contourIndex);
return PathMeasure_length(_ptr, contourIndex);
}
public unsafe Tangent getTangentForOffset(int contourIndex, float distance) {

PathMeasure_getPosTan(contourIndex, distance, posTanPtr);
PathMeasure_getPosTan(_ptr, contourIndex, distance, posTanPtr);
}
if (posTan[0] == 0.0f) {

public Path extractPath(int contourIndex, float start, float end, bool startWithMoveTo = true) {
D.assert(contourIndex <= currentContourIndex,
() => $"Iterator must be advanced before index {contourIndex} can be used.");
IntPtr pathPtr = PathMeasure_getSegment(contourIndex, start, end, startWithMoveTo);
IntPtr pathPtr = PathMeasure_getSegment(_ptr, contourIndex, start, end, startWithMoveTo);
return PathMeasure_isClosed(contourIndex);
return PathMeasure_isClosed(_ptr, contourIndex);
bool next = PathMeasure_nativeNextContour();
bool next = PathMeasure_nativeNextContour(_ptr);
if (next) {
currentContourIndex++;
}

static extern void PathMeasure_dispose(IntPtr ptr);
[DllImport(NativeBindings.dllName)]
static extern float PathMeasure_length(int contourIndex);
static extern float PathMeasure_length(IntPtr ptr, int contourIndex);
static extern unsafe void PathMeasure_getPosTan(int contourIndex, float distance, float* posTan);
static extern unsafe void PathMeasure_getPosTan(IntPtr ptr, int contourIndex, float distance, float* posTan);
static extern IntPtr PathMeasure_getSegment(int contourIndex, float start, float end,
static extern IntPtr PathMeasure_getSegment(IntPtr ptr, int contourIndex, float start, float end,
static extern bool PathMeasure_isClosed(int contourIndex);
static extern bool PathMeasure_isClosed(IntPtr ptr, int contourIndex);
static extern bool PathMeasure_nativeNextContour();
static extern bool PathMeasure_nativeNextContour(IntPtr ptr);
}
public class ColorFilter : IEquatable<ColorFilter> {

正在加载...
取消
保存