Fix consider svga_offset for putImageData

This commit is contained in:
Fabian 2022-02-24 00:36:58 +01:00
parent 4eb1e5035e
commit d1a949d881

View file

@ -2280,7 +2280,7 @@ VGAScreen.prototype.screen_fill_buffer = function()
if(this.svga_enabled)
{
let min_y = 0;
let max_y = this.svga_height - 1;
let max_y = this.svga_height;
if(this.svga_bpp === 8)
{
@ -2300,19 +2300,21 @@ VGAScreen.prototype.screen_fill_buffer = function()
this.cpu.svga_fill_pixel_buffer(this.svga_bpp, this.svga_offset);
const bytes_per_pixel = this.svga_bpp === 15 ? 2 : this.svga_bpp / 8;
const bytes_per_line = bytes_per_pixel * this.svga_width;
min_y = this.cpu.svga_dirty_bitmap_min_offset[0] / bytes_per_line | 0;
max_y = this.cpu.svga_dirty_bitmap_max_offset[0] / bytes_per_line | 0;
min_y = ((this.cpu.svga_dirty_bitmap_min_offset[0] / bytes_per_pixel | 0) - this.svga_offset) / this.svga_width;
max_y = ((this.cpu.svga_dirty_bitmap_max_offset[0] / bytes_per_pixel | 0) - this.svga_offset) / this.svga_width + 1;
}
if(min_y < max_y)
{
min_y = Math.max(min_y, 0);
max_y = Math.min(max_y, this.svga_height);
this.bus.send("screen-fill-buffer-end", [{
image_data: this.image_data,
screen_x: 0, screen_y: min_y,
buffer_x: 0, buffer_y: min_y,
buffer_width: this.svga_width,
buffer_height: max_y - min_y + 1,
buffer_height: max_y - min_y,
}]);
}
}