Fix zoom handling and update screen calculations

- Corrected loop bounds in 'GrZoomInScreen' to use 'GR_HEIGHT' and 'GR_WIDTH' constants instead of dynamic values from 'gr.dc2'.
- Updated 'src' offset calculations to use 'GR_WIDTH' instead of 'gr.dc2->width_internal'.
- Simplified 'GrUpdateScreen32' to use fixed 'GR_HEIGHT' and 'GR_WIDTH' values for screen updates, removing unnecessary calculations and size adjustments based on 'gr.dc2' and 'gr.zoomed_dc'.
This commit is contained in:
GutPuncher 2024-08-29 01:48:17 -04:00
parent b08c10e343
commit 38c41e551a
No known key found for this signature in database
GPG key ID: 38CE0A7B6841D1C7

View file

@ -157,15 +157,13 @@ U0 GrZoomInScreen()
src = gr.dc2->body + gr.sx + gr.sy * gr.dc2->width_internal; src = gr.dc2->body + gr.sx + gr.sy * gr.dc2->width_internal;
dst = gr.zoomed_dc->body; dst = gr.zoomed_dc->body;
// for (i = 0; i < GR_HEIGHT / gr.screen_zoom; i++) for (i = 0; i < GR_HEIGHT / gr.screen_zoom; i++)
for (i = 0; i < gr.dc2->height / gr.screen_zoom; i++)
{ {
k = gr.screen_zoom; k = gr.screen_zoom;
while (k--) while (k--)
{ {
src2 = src; src2 = src;
// for (l = 0; l < GR_WIDTH / gr.screen_zoom; l++) for (l = 0; l < GR_WIDTH / gr.screen_zoom; l++)
for (l = 0; l < gr.dc2->width_internal / gr.screen_zoom; l++)
{ {
for (j = 0; j < gr.screen_zoom - 1; j++) for (j = 0; j < gr.screen_zoom - 1; j++)
*dst++ = *src2; *dst++ = *src2;
@ -173,8 +171,7 @@ U0 GrZoomInScreen()
*dst++ = *src2++; *dst++ = *src2++;
} }
} }
// src += GR_WIDTH; src += GR_WIDTH;
src += gr.dc2->width_internal;
} }
} }
@ -389,31 +386,23 @@ U0 GrCalcScreenUpdates()
U0 GrUpdateScreen32() U0 GrUpdateScreen32()
{ {
U64 size, x, y, wi, yi, w = sys_framebuffer_pitch / (sys_framebuffer_bpp / 8); U64 x, y, wi, yi, w = sys_framebuffer_pitch / (sys_framebuffer_bpp / 8);
U32 *dst; U32 *dst;
U8 *src; U8 *src;
if (gr.screen_zoom == 1) if (gr.screen_zoom == 1)
{
src = gr.dc2->body; src = gr.dc2->body;
size = src + gr.dc2->height * gr.dc2->width_internal;
wi = gr.dc2->width_internal;
yi = gr.dc2->height;
}
else else
{ {
GrZoomInScreen; GrZoomInScreen;
src = gr.zoomed_dc->body; src = gr.zoomed_dc->body;
size = src + gr.zoomed_dc->height * gr.zoomed_dc->width_internal;
wi = gr.zoomed_dc->width_internal;
yi = gr.zoomed_dc->height;
} }
for (y = 0; y < yi; y++) for (y = 0; y < GR_HEIGHT; y++)
{ {
for (x = 0; x < wi; x++) for (x = 0; x < GR_WIDTH; x++)
{ {
dst = text.raw_screen + x + y * w; dst = text.raw_screen + x + y * w;
*dst = gr_palette[src[x + y * wi] & 0xFF]; *dst = gr_palette[src[x + y * GR_WIDTH] & 0xFF];
} }
} }