From f8c984502614dc5e41d5ebf0f886edfba2c05d00 Mon Sep 17 00:00:00 2001 From: GutPuncher Date: Thu, 29 Aug 2024 00:49:38 -0400 Subject: [PATCH] Cleaning up leftover scraps from graphics code hacking, reimplementing GrCalcScreenUpdates --- src/System/Gr/GrScreen.ZC | 46 +++++++++++++++------------------------ 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/src/System/Gr/GrScreen.ZC b/src/System/Gr/GrScreen.ZC index 32a50f9c..2d2f9600 100755 --- a/src/System/Gr/GrScreen.ZC +++ b/src/System/Gr/GrScreen.ZC @@ -362,35 +362,36 @@ U0 DCBlotColor8(CDC *dc, CDC *img) U0 GrCalcScreenUpdates() { - U16 *screen, *last_screen = gr.screen_cache; - U64 i, *src = text.raw_screen, *dst = text.fb_alias, diffs_size = GR_WIDTH * GR_HEIGHT / 2; + U8 *screen, *last_screen = gr.screen_cache; + U32 i, *src = text.raw_screen, *dst = text.fb_alias, diffs_size = GR_WIDTH * GR_HEIGHT; + U64 x, y, w = sys_framebuffer_pitch / (sys_framebuffer_bpp / 8); if (gr.screen_zoom == 1) screen = gr.dc2->body; else screen = gr.zoomed_dc->body; -/* - for (i = 0; i < diffs_size; i++) + for (y = 0; y < GR_HEIGHT; y++) { - if (screen[i] != last_screen[i]) - dst[i] = src[i]; + for (x = 0; x < GR_WIDTH; x++) + { + i = x + y * GR_WIDTH; + if (screen[i] != last_screen[i]) + { + dst = text.fb_alias + x + y * w; + src = text.raw_screen + x + y * w; + *dst = *src; + } + } } -*/ -// MemCopy(gr.screen_cache, screen, diffs_size * 2); + MemCopy(gr.screen_cache, screen, diffs_size * 2); } U0 GrUpdateScreen32() { -// U64 size, *dst; - U64 size; + U64 size, x, y, wi, yi, w = sys_framebuffer_pitch / (sys_framebuffer_bpp / 8); U32 *dst; U8 *src; - U64 x; - U64 y; - U64 w = sys_framebuffer_pitch / (sys_framebuffer_bpp / 8); - U64 wi; - U64 yi; if (gr.screen_zoom == 1) { @@ -406,24 +407,13 @@ U0 GrUpdateScreen32() size = src + gr.zoomed_dc->height * gr.zoomed_dc->width_internal; wi = gr.zoomed_dc->width_internal; yi = gr.zoomed_dc->height; -// SysLog("%d\n", wi); -// SysLog("%d\n\n", yi); } -// dst = text.raw_screen; -// while (src < size) // need to do 1 pixel at a time... //draw 2 pixels at a time -// *dst++ = gr_palette[*src++ & 0xFF] | gr_palette[*src++ & 0xFF] << 32; - for (y = 0; y < yi; y++) { for (x = 0; x < wi; x++) { -// dst = text.raw_screen[x + (y * sys_framebuffer_width)]; - dst = text.fb_alias + x + (y * w); -// dst = text.raw_screen + x + (y * w); -// *dst = gr_palette[*src++ & 0xFF]; -// *dst = gr_palette[src[x + (y * sys_framebuffer_width)] & 0xFF]; - *dst = gr_palette[src[x + (y * wi)] & 0xFF]; -// *dst = 0xFFFF0000; + dst = text.raw_screen + x + y * w; + *dst = gr_palette[src[x + y * wi] & 0xFF]; } }