浏览代码

Make Async.

/main
Yuncong Zhang 5 年前
当前提交
1b035cf9
共有 3 个文件被更改,包括 13 次插入22 次删除
  1. 23
      Runtime/painting/image_stream.cs
  2. 8
      Runtime/ui/painting/codec.cs
  3. 4
      Runtime/ui/painting/codec_gif.cs

23
Runtime/painting/image_stream.cs


}
void _decodeNextFrameAndSchedule() {
this._codec.getNextFrame().Then(frame => {
this._nextFrame = frame;
var frame = this._codec.getNextFrame();
this._nextFrame = frame;
if (this._codec.frameCount == 1) {
this._emitFrame(new ImageInfo(image: this._nextFrame.image, scale: this._scale));
return;
}
if (this._codec.frameCount == 1) {
this._emitFrame(new ImageInfo(image: this._nextFrame.image, scale: this._scale));
return;
}
SchedulerBinding.instance.scheduleFrameCallback(this._handleAppFrame);
},
ex => {
this.reportError(
context: "resolving an image frame",
exception: ex,
informationCollector: this._informationCollector,
silent: true
);
});
SchedulerBinding.instance.scheduleFrameCallback(this._handleAppFrame);
}
void _emitFrame(ImageInfo imageInfo) {

8
Runtime/ui/painting/codec.cs


public interface Codec : IDisposable {
int frameCount { get; }
int repetitionCount { get; }
IPromise<FrameInfo> getNextFrame();
FrameInfo getNextFrame();
}
public class ImageCodec : Codec {

get { return 0; }
}
public IPromise<FrameInfo> getNextFrame() {
public FrameInfo getNextFrame() {
return Promise<FrameInfo>.Resolved(new FrameInfo {
return new FrameInfo {
});
};
}
public void Dispose() {

4
Runtime/ui/painting/codec_gif.cs


}
}
public IPromise<FrameInfo> getNextFrame() {
public FrameInfo getNextFrame() {
this._nextFrame();
this._texture.LoadRawTextureData(this._frameData.gifFrame.bytes);
this._texture.Apply();

};
return Promise<FrameInfo>.Resolved(this._frameData.frameInfo);
return this._frameData.frameInfo;
}
public void Dispose() {

正在加载...
取消
保存