浏览代码

fix: app crash because of animating gif

/zgh-build_scripts
guanghuispark 3 年前
当前提交
c736b397
共有 7 个文件被更改,包括 131 次插入4 次删除
  1. 1
      com.unity.uiwidgets/Runtime/painting/image_stream.cs
  2. 4
      com.unity.uiwidgets/Runtime/rendering/image.cs
  3. 36
      com.unity.uiwidgets/Runtime/rendering/layer.cs
  4. 1
      com.unity.uiwidgets/Runtime/rendering/view.cs
  5. 13
      com.unity.uiwidgets/Runtime/ui/compositing.cs
  6. 74
      com.unity.uiwidgets/Runtime/ui/painting.cs
  7. 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) {

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


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

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

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

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

child._nextSibling = null;
child._previousSibling = null;
dropChild(child);
child.DisposeCPter();
D.assert(!child.attached);
}

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

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


var builder = new SceneBuilder();
using (var scene = layer.buildScene(builder)) {
Window.instance.render(scene);
builder.DisposeCPtr();
}
D.assert(() => {

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


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

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


}
public class Image : NativeWrapperDisposable, IEquatable<Image> {
private bool isDisposed = false;
Image_dispose(ptr);
if(isDisposed){
return;
}
isDisposed = true;
Image_dispose(ptr);
}
public void DisposeCPtr() {
if(isDisposed){
return;
}
isDisposed = true;
Image_dispose(_ptr);
}
public int width => Image_width(_ptr);

public delegate void ImageDecoderCallback(Image result);
public class FrameInfo : NativeWrapper {
bool isDisposed = false;
if (isDisposed) {
return;
}
isDisposed = true;
internal void DisposeCPtr() {
if (isDisposed) {
return;
}
isDisposed = true;
FrameInfo_dispose(_ptr);
}
public Image image => new Image(FrameInfo_image(_ptr));
private Image _image;
public Image image {
get {
if(_image == null){
_image = new Image(FrameInfo_image(_ptr));
}
return _image;
}
}
[DllImport(NativeBindings.dllName)]
static extern void FrameInfo_dispose(IntPtr ptr);

}
public abstract class EngineLayer : NativeWrapper {
private bool isDisposed = false;
if(isDisposed){
return;
}
isDisposed = true;
}
internal void DisposeCPtr()
{
if(isDisposed){
return;
}
isDisposed = true;
EngineLayer_dispose(_ptr);
}
[DllImport(NativeBindings.dllName)]

}
public class Picture : NativeWrapperDisposable {
private bool isDisposed = false;
if(isDisposed){
return;
}
isDisposed = true;
}
public void DisposeCPtr(){
if(isDisposed){
return;
}
isDisposed = true;
Picture_dispose(_ptr);
}
public Future<Image> toImage(int width, int height) {

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


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

正在加载...
取消
保存