From 4e82ee68e544a7c5ec895fee02cdf03af8827a3e Mon Sep 17 00:00:00 2001 From: ascholer Date: Fri, 1 Mar 2024 11:10:52 -0800 Subject: [PATCH 1/2] Update as many lines as necessary during image repaint --- src/lib/image.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/lib/image.js b/src/lib/image.js index 540206a389..b627455034 100644 --- a/src/lib/image.js +++ b/src/lib/image.js @@ -206,13 +206,11 @@ $builtinmodule = function (name) { type: "Sk.promise", promise: new Promise(function (resolve, reject) { self.updateCount++; - if ((self.updateCount % self.updateInterval) === 0) { + if ((self.updateCount % self.updateInterval) === 0 || + (self.updateCount === self.width * self.height)) { if (self.lastx + self.updateInterval >= self.width) { self.lastCtx.putImageData(self.imagedata, self.lastUlx, self.lastUly, - 0, self.lasty, self.width, 2); - } else if (self.lasty + self.updateInterval >= self.height) { - self.lastCtx.putImageData(self.imagedata, self.lastUlx, self.lastUly, - self.lastx, 0, 2, self.height); + 0, self.lasty, self.width, Math.ceil((self.lastx + self.updateInterval) / self.width)); } else { self.lastCtx.putImageData(self.imagedata, self.lastUlx, self.lastUly, Math.min(x, self.lastx), From 47850aa88ba8a7a9fe89cc89e6aae138afe2d979 Mon Sep 17 00:00:00 2001 From: ascholer Date: Fri, 1 Mar 2024 12:01:23 -0800 Subject: [PATCH 2/2] Always do full image repaint --- src/lib/image.js | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/src/lib/image.js b/src/lib/image.js index b627455034..2833913093 100644 --- a/src/lib/image.js +++ b/src/lib/image.js @@ -208,18 +208,7 @@ $builtinmodule = function (name) { self.updateCount++; if ((self.updateCount % self.updateInterval) === 0 || (self.updateCount === self.width * self.height)) { - if (self.lastx + self.updateInterval >= self.width) { - self.lastCtx.putImageData(self.imagedata, self.lastUlx, self.lastUly, - 0, self.lasty, self.width, Math.ceil((self.lastx + self.updateInterval) / self.width)); - } else { - self.lastCtx.putImageData(self.imagedata, self.lastUlx, self.lastUly, - Math.min(x, self.lastx), - Math.min(y, self.lasty), - Math.max(Math.abs(x - self.lastx), 1), - Math.max(Math.abs(y - self.lasty), 1)); - } - self.lastx = x; - self.lasty = y; + self.lastCtx.putImageData(self.imagedata, 0, 0); if (self.delay > 0) { window.setTimeout(resolve, self.delay); } else {