mirror of
https://github.com/Zeal-Operating-System/ZealOS.git
synced 2024-12-24 22:50:28 +00:00
Use framebuffer pitch instead of width where necessary
This commit is contained in:
parent
b1e0034183
commit
41e7e302d5
2 changed files with 9 additions and 7 deletions
|
@ -8,7 +8,9 @@ See also $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$().
|
|||
*/
|
||||
I64 i, row, col, x, y;
|
||||
U32 *framebuffer;
|
||||
U64 ch_bitmap;
|
||||
U64 ch_bitmap, fb_width_from_pitch;
|
||||
|
||||
fb_width_from_pitch = sys_framebuffer_pitch / (sys_framebuffer_bpp / 8);
|
||||
|
||||
if (!(text.raw_flags & RAWF_SHOW_DOLLAR))
|
||||
{
|
||||
|
@ -60,17 +62,17 @@ See also $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$().
|
|||
{//Scroll screen down
|
||||
|
||||
MemCopy(text.fb_alias,
|
||||
text.fb_alias + sys_framebuffer_width * FONT_HEIGHT,
|
||||
(text.screen_size - sys_framebuffer_width * FONT_HEIGHT) * sizeof(U32));
|
||||
text.fb_alias + fb_width_from_pitch * FONT_HEIGHT,
|
||||
(text.screen_size - fb_width_from_pitch * FONT_HEIGHT) * sizeof(U32));
|
||||
|
||||
MemSetU32(text.fb_alias + text.screen_size - sys_framebuffer_width * FONT_HEIGHT, BLACK32, sys_framebuffer_width * FONT_HEIGHT);
|
||||
MemSetU32(text.fb_alias + text.screen_size - fb_width_from_pitch * FONT_HEIGHT, BLACK32, fb_width_from_pitch * FONT_HEIGHT);
|
||||
text.raw_col -= text.cols ;
|
||||
row = text.rows - 1;
|
||||
}
|
||||
x = col * FONT_WIDTH;
|
||||
y = row * FONT_HEIGHT;
|
||||
ch_bitmap = text.font[ch & 0xFF];
|
||||
framebuffer = text.fb_alias + sys_framebuffer_width * y + x;
|
||||
framebuffer = text.fb_alias + fb_width_from_pitch * y + x;
|
||||
|
||||
PUSHFD
|
||||
CLI
|
||||
|
@ -81,7 +83,7 @@ See also $LK,"GrUpdateScreen",A="MN:GrUpdateScreen"$().
|
|||
else
|
||||
*framebuffer++ = BLACK32;
|
||||
if (i & (FONT_WIDTH - 1) == FONT_WIDTH - 1)
|
||||
framebuffer += sys_framebuffer_width - FONT_WIDTH;
|
||||
framebuffer += fb_width_from_pitch - FONT_WIDTH;
|
||||
ch_bitmap >>= 1;
|
||||
}
|
||||
POPFD
|
||||
|
|
|
@ -91,7 +91,7 @@ U0 SysGrInit()
|
|||
text.cols = sys_framebuffer_width / FONT_WIDTH;
|
||||
text.rows = sys_framebuffer_height / FONT_HEIGHT;
|
||||
|
||||
text.screen_size = sys_framebuffer_width * sys_framebuffer_height;
|
||||
text.screen_size = sys_framebuffer_pitch / (sys_framebuffer_bpp / 8) * sys_framebuffer_height;
|
||||
text.buffer_size = text.screen_size * 4; //buffer for 32-bit, but only 16 colors now.
|
||||
text.raw_screen = CAlloc(text.buffer_size);
|
||||
text.fb_alias = sys_framebuffer_addr;
|
||||
|
|
Loading…
Reference in a new issue