Remove pointless Display.clear()

It served no meaningful purpose and it had bugs. So let's remove it
rather than try to fix it.
This commit is contained in:
Pierre Ossman 2019-08-23 15:05:58 +02:00 committed by Lauri Kasanen
parent 4cc536636a
commit c211f31113
4 changed files with 0 additions and 19 deletions

View File

@ -60,8 +60,6 @@ export default class Display {
Log.Debug("User Agent: " + navigator.userAgent); Log.Debug("User Agent: " + navigator.userAgent);
this.clear();
// Check canvas features // Check canvas features
if (!('createImageData' in this._drawCtx)) { if (!('createImageData' in this._drawCtx)) {
throw new Error("Canvas does not support createImageData"); 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() { pending() {
return this._renderQ.length > 0; return this._renderQ.length > 0;
} }

View File

@ -193,7 +193,6 @@ export default class RFB extends EventTargetMixin {
throw exc; throw exc;
} }
this._display.onflush = this._onFlush.bind(this); this._display.onflush = this._onFlush.bind(this);
this._display.clear();
this._keyboard = new Keyboard(this._canvas); this._keyboard = new Keyboard(this._canvas);
this._keyboard.onkeyevent = this._handleKeyEvent.bind(this); this._keyboard.onkeyevent = this._handleKeyEvent.bind(this);

View File

@ -99,7 +99,6 @@ None
| absY | (y) | Return Y relative to the remote display | absY | (y) | Return Y relative to the remote display
| resize | (width, height) | Set width and height | resize | (width, height) | Set width and height
| flip | (from_queue) | Update the visible canvas with the contents of the rendering canvas | 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 | pending | () | Check if there are waiting items in the render queue
| flush | () | Resume processing the render queue unless it's empty | flush | () | Resume processing the render queue unless it's empty
| fillRect | (x, y, width, height, color, from_queue) | Draw a filled in rectangle | fillRect | (x, y, width, height, color, from_queue) | Draw a filled in rectangle

View File

@ -269,15 +269,6 @@ describe('Display/Canvas Helper', function () {
display.resize(4, 4); 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 () { it('should not draw directly on the target canvas', function () {
display.fillRect(0, 0, 4, 4, [0, 0, 0xff]); display.fillRect(0, 0, 4, 4, [0, 0, 0xff]);
display.flip(); display.flip();