Commit 424c82af authored by Jiri Slaby (SUSE)'s avatar Jiri Slaby (SUSE) Committed by Greg Kroah-Hartman

tty: vt: saner names for more scroll variables

Rename more variables (t, b, s, d) -> (top, bottom, src, dst) to make
them more obvious.
Signed-off-by: default avatarJiri Slaby (SUSE) <jirislaby@kernel.org>
Reviewed-by: default avatarIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20230112080136.4929-10-jirislaby@kernel.orgSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8aad24ad
...@@ -420,21 +420,22 @@ static void juggle_array(u32 **array, unsigned int size, unsigned int nr) ...@@ -420,21 +420,22 @@ static void juggle_array(u32 **array, unsigned int size, unsigned int nr)
} }
} }
static void vc_uniscr_scroll(struct vc_data *vc, unsigned int t, unsigned int b, static void vc_uniscr_scroll(struct vc_data *vc, unsigned int top,
enum con_scroll dir, unsigned int nr) unsigned int bottom, enum con_scroll dir,
unsigned int nr)
{ {
u32 **uni_lines = vc->vc_uni_lines; u32 **uni_lines = vc->vc_uni_lines;
unsigned int size = b - t; unsigned int size = bottom - top;
if (!uni_lines) if (!uni_lines)
return; return;
if (dir == SM_DOWN) { if (dir == SM_DOWN) {
juggle_array(&uni_lines[top], size, size - nr); juggle_array(&uni_lines[top], size, size - nr);
vc_uniscr_clear_lines(vc, t, nr); vc_uniscr_clear_lines(vc, top, nr);
} else { } else {
juggle_array(&uni_lines[top], size, nr); juggle_array(&uni_lines[top], size, nr);
vc_uniscr_clear_lines(vc, b - nr, nr); vc_uniscr_clear_lines(vc, bottom - nr, nr);
} }
} }
...@@ -556,27 +557,30 @@ void vc_uniscr_copy_line(const struct vc_data *vc, void *dest, bool viewed, ...@@ -556,27 +557,30 @@ void vc_uniscr_copy_line(const struct vc_data *vc, void *dest, bool viewed,
} }
} }
static void con_scroll(struct vc_data *vc, unsigned int t, unsigned int b, static void con_scroll(struct vc_data *vc, unsigned int top,
enum con_scroll dir, unsigned int nr) unsigned int bottom, enum con_scroll dir,
unsigned int nr)
{ {
u16 *clear, *d, *s; u16 *clear, *dst, *src;
if (t + nr >= b) if (top + nr >= bottom)
nr = b - t - 1; nr = bottom - top - 1;
if (b > vc->vc_rows || t >= b || nr < 1) if (bottom > vc->vc_rows || top >= bottom || nr < 1)
return; return;
vc_uniscr_scroll(vc, t, b, dir, nr);
if (con_is_visible(vc) && vc->vc_sw->con_scroll(vc, t, b, dir, nr)) vc_uniscr_scroll(vc, top, bottom, dir, nr);
if (con_is_visible(vc) &&
vc->vc_sw->con_scroll(vc, top, bottom, dir, nr))
return; return;
s = clear = (u16 *)(vc->vc_origin + vc->vc_size_row * t); src = clear = (u16 *)(vc->vc_origin + vc->vc_size_row * top);
d = (u16 *)(vc->vc_origin + vc->vc_size_row * (t + nr)); dst = (u16 *)(vc->vc_origin + vc->vc_size_row * (top + nr));
if (dir == SM_UP) { if (dir == SM_UP) {
clear = s + (b - t - nr) * vc->vc_cols; clear = src + (bottom - top - nr) * vc->vc_cols;
swap(s, d); swap(src, dst);
} }
scr_memmovew(d, s, (b - t - nr) * vc->vc_size_row); scr_memmovew(dst, src, (bottom - top - nr) * vc->vc_size_row);
scr_memsetw(clear, vc->vc_video_erase_char, vc->vc_size_row * nr); scr_memsetw(clear, vc->vc_video_erase_char, vc->vc_size_row * nr);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment