From c211f311135a679ccba45105b39cf8776ff59166 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Fri, 23 Aug 2019 15:05:58 +0200 Subject: [PATCH] Remove pointless Display.clear() It served no meaningful purpose and it had bugs. So let's remove it rather than try to fix it. --- kasmweb/core/display.js | 8 -------- kasmweb/core/rfb.js | 1 - kasmweb/docs/API-internal.md | 1 - kasmweb/tests/test.display.js | 9 --------- 4 files changed, 19 deletions(-) diff --git a/kasmweb/core/display.js b/kasmweb/core/display.js index 346f9fd..89cdd54 100644 --- a/kasmweb/core/display.js +++ b/kasmweb/core/display.js @@ -60,8 +60,6 @@ export default class Display { Log.Debug("User Agent: " + navigator.userAgent); - this.clear(); - // Check canvas features if (!('createImageData' in this._drawCtx)) { throw new Error("Canvas does not support createImageData"); @@ -301,12 +299,6 @@ export default class Display { } } - clear() { - this.resize(240, 20); - this._drawCtx.clearRect(0, 0, this._fb_width, this._fb_height); - this.flip(); - } - pending() { return this._renderQ.length > 0; } diff --git a/kasmweb/core/rfb.js b/kasmweb/core/rfb.js index 9fd5909..7acc281 100644 --- a/kasmweb/core/rfb.js +++ b/kasmweb/core/rfb.js @@ -193,7 +193,6 @@ export default class RFB extends EventTargetMixin { throw exc; } this._display.onflush = this._onFlush.bind(this); - this._display.clear(); this._keyboard = new Keyboard(this._canvas); this._keyboard.onkeyevent = this._handleKeyEvent.bind(this); diff --git a/kasmweb/docs/API-internal.md b/kasmweb/docs/API-internal.md index cef79a4..f7346a9 100644 --- a/kasmweb/docs/API-internal.md +++ b/kasmweb/docs/API-internal.md @@ -99,7 +99,6 @@ None | absY | (y) | Return Y relative to the remote display | resize | (width, height) | Set width and height | flip | (from_queue) | Update the visible canvas with the contents of the rendering canvas -| clear | () | Clear the display | pending | () | Check if there are waiting items in the render queue | flush | () | Resume processing the render queue unless it's empty | fillRect | (x, y, width, height, color, from_queue) | Draw a filled in rectangle diff --git a/kasmweb/tests/test.display.js b/kasmweb/tests/test.display.js index 2da47cf..f44f6c6 100644 --- a/kasmweb/tests/test.display.js +++ b/kasmweb/tests/test.display.js @@ -269,15 +269,6 @@ describe('Display/Canvas Helper', function () { display.resize(4, 4); }); - it('should clear the screen on #clear', function () { - display.fillRect(0, 0, 4, 4, [0x00, 0x00, 0xff]); - display.clear(); - display.resize(4, 4); - const empty = []; - for (let i = 0; i < 4 * display._fb_width * display._fb_height; i++) { empty[i] = 0; } - expect(display).to.have.displayed(new Uint8Array(empty)); - }); - it('should not draw directly on the target canvas', function () { display.fillRect(0, 0, 4, 4, [0, 0, 0xff]); display.flip();