浏览代码

Merge pull request #263 from Unity-Technologies/siyaoH/1.17/fixLottie

Fix Lottie crash during wrong path
/main
GitHub 3 年前
当前提交
6ffdc993
共有 5 个文件被更改,包括 26 次插入3 次删除
  1. 7
      com.unity.uiwidgets/Runtime/ui/painting.cs
  2. 22
      engine/src/lib/ui/painting/skottie.cc

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


public class Skottie : NativeWrapper {
public Skottie(string path) {
_setPtr(Skottie_Construct(path));
var Id = Skottie_Construct(path);
if(Id == IntPtr.Zero){
Debug.Log($"cannot load lottie from {path}, please check file exist and valid");
}else {
_setPtr(Id);
}
}
public override void DisposePtr(IntPtr ptr) {

22
engine/src/lib/ui/painting/skottie.cc


path = (char*)fileOut;
#endif
sk_sp<skottie::Animation> animation_ = skottie::Animation::MakeFromFile(path);
if(animation_ == nullptr){
return nullptr;
}
return fml::MakeRefCounted<Skottie>(animation_);
}

UIWIDGETS_API(Skottie*)
Skottie_Construct(char* path) {
fml::RefPtr<Skottie> skottie = Skottie::Create(path);
if(skottie.get() == nullptr){
return nullptr;
}
Skottie_Dispose(Skottie* ptr) { ptr->Release(); }
Skottie_Dispose(Skottie* ptr) {
if(ptr == nullptr){
return;
}
ptr->Release();
}
if(ptr == nullptr){
return;
}
Skottie_Duration(Skottie* ptr) { return ptr->duration(); }
Skottie_Duration(Skottie* ptr) {
if(ptr == nullptr){
return 0;
}
return ptr->duration(); }
} // namespace uiwidgets

部分文件因为文件数量过多而无法显示

正在加载...
取消
保存