浏览代码

Fix gif not animating problem.

/main
Yuncong Zhang 6 年前
当前提交
03795422
共有 3 个文件被更改,包括 28 次插入2 次删除
  1. 20
      Runtime/flow/raster_cache.cs
  2. 2
      Runtime/ui/painting/codec_gif.cs
  3. 8
      Runtime/ui/painting/image.cs

20
Runtime/flow/raster_cache.cs


return false;
}
foreach (DrawCmd drawCmd in picture.drawCmds) {
switch (drawCmd) {
case DrawImage cmd: {
if (cmd.image.isDynamic)
return false;
break;
}
case DrawImageNine cmd: {
if (cmd.image.isDynamic)
return false;
break;
}
case DrawImageRect cmd: {
if (cmd.image.isDynamic)
return false;
break;
}
}
}
return true;
}

2
Runtime/ui/painting/codec_gif.cs


if (this._texture == null) {
this._texture = new Texture2D(this._width, this._height, TextureFormat.BGRA32, false);
this._texture.hideFlags = HideFlags.HideAndDontSave;
this._image = new Image(this._texture);
this._image = new Image(this._texture, isDynamic: true);
this._frameData.frameInfo.image = this._image;
}
this._frameData.gifFrame = this._decoder.currentFrame;

8
Runtime/ui/painting/image.cs


Texture _texture;
readonly bool _noDispose;
readonly bool _isAsset;
readonly bool _isDynamic;
public Image(Texture texture, bool noDispose = false, bool isAsset = false, AssetBundle bundle = null) {
public Image(Texture texture, bool noDispose = false, bool isAsset = false, AssetBundle bundle = null, bool isDynamic = false) {
D.assert(!noDispose || !isAsset && bundle == null);
D.assert(isAsset || bundle == null);

this._bundle = bundle;
this._isDynamic = isDynamic;
}
public int width {

public Texture texture {
get { return this._texture; }
}
public bool isDynamic {
get { return this._isDynamic; }
}
~Image() {

正在加载...
取消
保存