浏览代码

Fix GIF memory overflow issue.

/main
Yuncong Zhang 5 年前
当前提交
25518add
共有 1 个文件被更改,包括 10 次插入5 次删除
  1. 15
      Runtime/ui/painting/codec_gif.cs

15
Runtime/ui/painting/codec_gif.cs


volatile int _repetitionCount;
volatile bool _isDone;
volatile int _frameIndex;
volatile Texture2D _texture;
readonly UIWidgetsCoroutine _coroutine;
public GifCodec(byte[] bytes) {

return frame.Then(frameData => {
this._nextFrame();
if (frameData.frameInfo != null) {
return frameData.frameInfo;
if (this._texture == null) {
this._texture = new Texture2D(this._width, this._height, TextureFormat.BGRA32, false);
this._texture.hideFlags = HideFlags.HideAndDontSave;
var tex = new Texture2D(this._width, this._height, TextureFormat.BGRA32, false);
tex.hideFlags = HideFlags.HideAndDontSave;
var tex = this._texture;
if (frameData.frameInfo != null) {
return frameData.frameInfo;
}
frameData.gifFrame = null; // dispose gifFrame
// frameData.gifFrame = null; // dispose gifFrame
return frameData.frameInfo;
});

正在加载...
取消
保存