StickerSpoof: Fix not correctly cleaning previous frame
This commit is contained in:
parent
3c8084ec36
commit
c1d2f0078f
|
@ -181,9 +181,6 @@ export default definePlugin({
|
||||||
|
|
||||||
let lastImg: HTMLImageElement | null = null;
|
let lastImg: HTMLImageElement | null = null;
|
||||||
for (const { left, top, width, height, disposeOp, img, delay } of frames) {
|
for (const { left, top, width, height, disposeOp, img, delay } of frames) {
|
||||||
if (disposeOp === ApngDisposeOp.BACKGROUND) {
|
|
||||||
ctx.clearRect(left, top, width, height);
|
|
||||||
}
|
|
||||||
ctx.drawImage(img, left, top, width, height);
|
ctx.drawImage(img, left, top, width, height);
|
||||||
|
|
||||||
const { data } = ctx.getImageData(0, 0, resolution, resolution);
|
const { data } = ctx.getImageData(0, 0, resolution, resolution);
|
||||||
|
@ -197,9 +194,12 @@ export default definePlugin({
|
||||||
delay,
|
delay,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (disposeOp === ApngDisposeOp.PREVIOUS && lastImg) {
|
if (disposeOp === ApngDisposeOp.BACKGROUND) {
|
||||||
|
ctx.clearRect(left, top, width, height);
|
||||||
|
} else if (disposeOp === ApngDisposeOp.PREVIOUS && lastImg) {
|
||||||
ctx.drawImage(lastImg, left, top, width, height);
|
ctx.drawImage(lastImg, left, top, width, height);
|
||||||
}
|
}
|
||||||
|
|
||||||
lastImg = img;
|
lastImg = img;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue