1.完善单帧gif闪退测试demo

2.帧数小于1的gif动图不再循环绘制

Signed-off-by: 李艺为 <liyiwei18@h-partners.com>
This commit is contained in:
李艺为 2023-08-18 11:17:33 +08:00
parent 237d0ca6b8
commit cb5d5eabe5
2 changed files with 4 additions and 3 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@ -608,6 +608,10 @@ export struct ImageKnifeComponent {
}
// draw Frame
this.drawFrame(frames, index, context, compWidth, compHeight);
//如果gif动图只有一帧的情况下不进行后面代码的逐帧绘制循环
if (frames.length <= 1) {
return
}
// 记录渲染结束时间点
let end = new Date().getTime();
@ -622,9 +626,6 @@ export struct ImageKnifeComponent {
}
// 减去程序执行消耗,剩余的准确延迟时间
let delayTime = Math.max(0, Math.floor(stayTime - diff));
if (!delayTime) {
delayTime = 100;
}
this.endGifLoopTime = end;
// 当前gif到第N帧,所对应的N渲染时间和N-1的停留时间。第一帧只有渲染时间没有停留时间