浏览代码

Merge pull request #181 from Unity-Technologies/revert-179-zgh/build_scripts

Revert "fix: app crash because of animating gif"
/main
GitHub 3 年前
当前提交
fc0c0ab8
共有 8 个文件被更改,包括 14 次插入99 次删除
  1. 1
      com.unity.uiwidgets/Runtime/painting/image_stream.cs
  2. 4
      com.unity.uiwidgets/Runtime/rendering/image.cs
  3. 29
      com.unity.uiwidgets/Runtime/rendering/layer.cs
  4. 2
      com.unity.uiwidgets/Runtime/rendering/view.cs
  5. 4
      com.unity.uiwidgets/Runtime/ui/compositing.cs
  6. 32
      com.unity.uiwidgets/Runtime/ui/native_bindings.cs
  7. 35
      com.unity.uiwidgets/Runtime/ui/painting.cs
  8. 6
      com.unity.uiwidgets/Runtime/widgets/widget_inspector.cs

1
com.unity.uiwidgets/Runtime/painting/image_stream.cs


_emitFrame(new ImageInfo(image: _nextFrame.image, scale: _scale));
_shownTimestamp = timestamp;
_frameDuration = _nextFrame.duration;
_nextFrame.DisposeCPtr();
_nextFrame = null;
int completedCycles = _codec.frameCount == 0 ? 0 : _framesEmitted / _codec.frameCount;

4
com.unity.uiwidgets/Runtime/rendering/image.cs


if (value == _image) {
return;
}
if(_image != null){
_image.DisposeCPtr();
}
_image = value;
markNeedsPaint();
if (_width == null || _height == null) {

29
com.unity.uiwidgets/Runtime/rendering/layer.cs


get { return (ContainerLayer) base.parent; }
}
public virtual void DisposeCPtr()
{
if(_engineLayer != null) {
_engineLayer.DisposeCPtr();
}
}
public bool _needsAddToScene = true;
protected void markNeedsAddToScene() {

protected EngineLayer engineLayer {
get { return _engineLayer; }
set {
if(_engineLayer != null){
_engineLayer.DisposeCPtr();
}
_engineLayer = value;
if (!alwaysNeedsAddToScene) {
if (parent != null && !parent.alwaysNeedsAddToScene) {

this.canvasBounds = canvasBounds;
}
public override void DisposeCPtr()
{
base.DisposeCPtr();
if(_picture != null){
_picture.DisposeCPtr();
}
}
public readonly Rect canvasBounds;
Picture _picture;

return addedLayers;
}
public override void DisposeCPtr() {
base.DisposeCPtr();
Layer child = firstChild;
while (child != null) {
Layer next = child.nextSibling;
child.DisposeCPtr();
child = next;
}
}
internal override void updateSubtreeNeedsAddToScene() {
base.updateSubtreeNeedsAddToScene();
Layer child = firstChild;

child._nextSibling = null;
D.assert(child.attached == attached);
dropChild(child);
child.DisposeCPtr();
child = next;
}

2
com.unity.uiwidgets/Runtime/rendering/view.cs


using (var scene = layer.buildScene(builder)) {
Window.instance.render(scene);
}
builder.DisposeCPtr();
D.assert(() => {
if (D.debugRepaintRainbowEnabled || D.debugRepaintTextRainbowEnabled) {
D.debugCurrentRepaintColor =

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


}
}
public class SceneBuilder : NativeWrapperCPtrDisposable {
public class SceneBuilder : NativeWrapper {
public override void DisposeCPtrImpl(IntPtr ptr) {
public override void DisposePtr(IntPtr ptr) {
SceneBuilder_dispose(ptr);
}

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


_dispose();
}
}
/// <summary>
/// This class is used to release c++ resources in advance without waiting for c# garbage collection.
/// Please make sure that the resource will not be used again after it is released.
/// Releasing resources prematurely may cause null pointer exceptions in references elsewhere.
///
/// Usage:
/// Use DisposeCPtr() to manually release c++ resources, and then add an interface to release unmanaged memory
/// in DisposeCPtrImpl(IntPtr ptr).
/// </summary>
public abstract class NativeWrapperCPtrDisposable : NativeWrapperDisposable {
public bool isDisposed = false;
protected NativeWrapperCPtrDisposable() {
}
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);
}
}

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


public int rowBytes;
}
public class Image : NativeWrapperCPtrDisposable, IEquatable<Image> {
public class Image : NativeWrapperDisposable, IEquatable<Image> {
public override void DisposeCPtrImpl(IntPtr ptr) {
Image_dispose(ptr);
public override void DisposePtr(IntPtr ptr) {
Image_dispose(ptr);
}
public int width => Image_width(_ptr);

public delegate void ImageDecoderCallback(Image result);
public class FrameInfo : NativeWrapperCPtrDisposable {
public class FrameInfo : NativeWrapper {
public override void DisposeCPtrImpl(IntPtr ptr) {
public override void DisposePtr(IntPtr ptr) {
private Image _image;
public Image image {
get {
if(_image == null){
_image = new Image(FrameInfo_image(_ptr));
}
return _image;
}
}
public Image image => new Image(FrameInfo_image(_ptr));
[DllImport(NativeBindings.dllName)]
static extern void FrameInfo_dispose(IntPtr ptr);

reverseDifference,
}
public abstract class EngineLayer : NativeWrapperCPtrDisposable {
public abstract class EngineLayer : NativeWrapper {
public override void DisposeCPtrImpl(IntPtr ptr) {
public override void DisposePtr(IntPtr ptr) {
EngineLayer_dispose(ptr);
}

bool transparentOccluder);
}
public class Picture : NativeWrapperCPtrDisposable {
public class Picture : NativeWrapperDisposable {
public override void DisposeCPtrImpl(IntPtr ptr) {
public override void DisposePtr(IntPtr ptr) {
Picture_dispose(ptr);
}

6
com.unity.uiwidgets/Runtime/widgets/widget_inspector.cs


}
public override void DisposeCPtr() {
if(_picture != null){
_picture.DisposeCPtr();
}
}
public override bool findAnnotations<S>(
AnnotationResult<S> result,
Offset localPosition,

正在加载...
取消
保存