From d32d677d0cf064188c52c95bd5cda90f6f3fa184 Mon Sep 17 00:00:00 2001 From: Ernest Wong Date: Tue, 23 Jan 2018 14:20:57 +1300 Subject: [PATCH] Revert bpp removal, and update screen events docs `bpp` was depended by main.js for the runtime info display --- docs/events.md | 4 ++-- src/browser/main.js | 2 +- src/vga.js | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/events.md b/docs/events.md index 08b93c45b7..d111ba078d 100644 --- a/docs/events.md +++ b/docs/events.md @@ -1,6 +1,6 @@ Here is a list of events that can be listened to using [`add_listener`](api.md#add_listenerstring-event-function-listener). These -can be used to programtically control the emulator. Events cannot be sent to +can be used to programmatically control the emulator. Events cannot be sent to the emulator (although it is internally implemented that way), use the [API](api.md) methods for that. @@ -25,7 +25,7 @@ See also: [screen.js](src/browser/screen.js). - `screen-put-pixel-linear` - `[number addr, number value]` - `screen-put-pixel-linear32` - `[number addr, number value]` - `screen-set-size-text` - `[number cols_count, number rows_count]` -- `screen-set-size-graphical` - `[number width, number height]` +- `screen-set-size-graphical` - `[number width, number height, number virtual_width, number virtual_height, number bpp]` - `screen-update-cursor` - `[number row, number col]` - `screen-update-cursor-scanline` - `[number cursor_scanline_start, number cursor_scanline_end]` diff --git a/src/browser/main.js b/src/browser/main.js index 912f1cadd0..38e529bedf 100644 --- a/src/browser/main.js +++ b/src/browser/main.js @@ -972,7 +972,7 @@ emulator.add_listener("screen-set-size-graphical", function(args) { $("info_res").textContent = args[0] + "x" + args[1]; - $("info_bpp").textContent = args[2]; + $("info_bpp").textContent = args[4]; }); diff --git a/src/vga.js b/src/vga.js index 3b6ae5960c..df8d467c16 100644 --- a/src/vga.js +++ b/src/vga.js @@ -1138,9 +1138,8 @@ VGAScreen.prototype.set_size_text = function(cols_count, rows_count) VGAScreen.prototype.set_size_graphical = function(width, height, bpp, virtual_width, virtual_height) { - this.stats.bpp = bpp; - var needs_update = !this.stats.is_graphical || + this.stats.bpp !== bpp || this.screen_width !== width || this.screen_height !== height || this.virtual_width !== virtual_width || @@ -1153,11 +1152,12 @@ VGAScreen.prototype.set_size_graphical = function(width, height, bpp, virtual_wi this.virtual_width = virtual_width; this.virtual_height = virtual_height; + this.stats.bpp = bpp; this.stats.is_graphical = true; this.stats.res_x = width; this.stats.res_y = height; - this.bus.send("screen-set-size-graphical", [width, height, virtual_width, virtual_height]); + this.bus.send("screen-set-size-graphical", [width, height, virtual_width, virtual_height, bpp]); } };