From 2661d5556b25d97026d64ada1945786ecb46ac1d Mon Sep 17 00:00:00 2001 From: Brad Parker Date: Mon, 30 Jan 2017 13:51:34 -0500 Subject: [PATCH] DOS: fix image scaling and colors for 16-bit core video --- gfx/drivers/vga_gfx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gfx/drivers/vga_gfx.c b/gfx/drivers/vga_gfx.c index eeb0d12b7f..20af045159 100644 --- a/gfx/drivers/vga_gfx.c +++ b/gfx/drivers/vga_gfx.c @@ -222,11 +222,11 @@ static bool vga_gfx_frame(void *data, const void *frame, for (x = 0; x < VGA_WIDTH; x++) { /* scale incoming frame to fit the screen */ - unsigned scaled_x = (width / VGA_WIDTH) * x; - unsigned scaled_y = (height / VGA_HEIGHT) * y; + unsigned scaled_x = (width / (float)VGA_WIDTH) * x; + unsigned scaled_y = (height / (float)VGA_HEIGHT) * y; unsigned short pixel = ((unsigned short*)frame_to_copy)[width * scaled_y + scaled_x]; - /* convert RGB565 to RGB332 */ + /* convert RGB565 to BGR332 */ unsigned r = (7.0f / 31.0f) * ((pixel & 0xF800) >> 11); unsigned g = (7.0f / 63.0f) * ((pixel & 0x07E0) >> 5); unsigned b = (3.0f / 31.0f) * ((pixel & 0x001F) >> 0);