浏览代码

move DisposePtr and DisposeCPtr to NativeWrapperCPtrDisposable

/zgh-build_scripts
guanghuispark 3 年前
当前提交
b4fcd672
共有 3 个文件被更改,包括 19 次插入69 次删除
  1. 17
      com.unity.uiwidgets/Runtime/ui/compositing.cs
  2. 13
      com.unity.uiwidgets/Runtime/ui/native_bindings.cs
  3. 58
      com.unity.uiwidgets/Runtime/ui/painting.cs

17
com.unity.uiwidgets/Runtime/ui/compositing.cs


}
}
public class SceneBuilder : NativeWrapper {
private bool isDisposed = false;
public class SceneBuilder : NativeWrapperCPtrDisposable {
public override void DisposePtr(IntPtr ptr) {
if(isDisposed){
return;
}
isDisposed = true;
public override void DisposeCPtrImpl(IntPtr ptr) {
}
public void DisposeCPtr() {
if(isDisposed){
return;
}
isDisposed = true;
SceneBuilder_dispose(_ptr);
}
readonly Dictionary<EngineLayer, string> _usedLayers = new Dictionary<EngineLayer, string>();

13
com.unity.uiwidgets/Runtime/ui/native_bindings.cs


protected NativeWrapperCPtrDisposable(IntPtr ptr) : base(ptr) {
}
public void DisposeCPtr() {
DisposePtr(_ptr);
}
public override void DisposePtr(IntPtr ptr) {
if(isDisposed){
return;
}
isDisposed = true;
DisposeCPtrImpl(ptr);
}
public abstract void DisposeCPtrImpl(IntPtr ptr);
}
}

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


internal Image(IntPtr ptr) : base(ptr) {
}
public override void DisposePtr(IntPtr ptr) {
if(isDisposed){
return;
}
isDisposed = true;
public override void DisposeCPtrImpl(IntPtr ptr) {
}
public void DisposeCPtr() {
if(isDisposed){
return;
}
isDisposed = true;
Image_dispose(_ptr);
}
public int width => Image_width(_ptr);

internal FrameInfo(IntPtr ptr) : base(ptr) {
}
public override void DisposePtr(IntPtr ptr) {
if (isDisposed) {
return;
}
isDisposed = true;
public override void DisposeCPtrImpl(IntPtr ptr) {
internal void DisposeCPtr() {
if (isDisposed) {
return;
}
isDisposed = true;
FrameInfo_dispose(_ptr);
}
public TimeSpan duration => TimeSpan.FromMilliseconds(_durationMillis);
int _durationMillis => FrameInfo_durationMillis(_ptr);

protected EngineLayer(IntPtr ptr) : base(ptr) {
}
public override void DisposePtr(IntPtr ptr) {
if(isDisposed){
return;
}
isDisposed = true;
public override void DisposeCPtrImpl(IntPtr ptr) {
}
internal void DisposeCPtr()
{
if(isDisposed){
return;
}
isDisposed = true;
EngineLayer_dispose(_ptr);
}
[DllImport(NativeBindings.dllName)]

internal Picture(IntPtr ptr) : base(ptr) {
}
public override void DisposePtr(IntPtr ptr) {
if(isDisposed){
return;
}
isDisposed = true;
public override void DisposeCPtrImpl(IntPtr ptr) {
}
public void DisposeCPtr(){
if(isDisposed){
return;
}
isDisposed = true;
Picture_dispose(_ptr);
}
public Future<Image> toImage(int width, int height) {

正在加载...
取消
保存