Reduce num of bits used for x/y multicell
This commit is contained in:
parent
e60b95d219
commit
bedc2ea1b9
3 changed files with 12 additions and 6 deletions
|
|
@ -43,6 +43,7 @@ static_assert(sizeof(GPUCell) == 20, "Fix the ordering of GPUCell");
|
|||
#define SCALE_BITS 3
|
||||
#define WIDTH_BITS 3
|
||||
#define SUBSCALE_BITS 4
|
||||
#define VALIGN_BITS 2
|
||||
|
||||
typedef union CPUCell {
|
||||
struct {
|
||||
|
|
@ -55,12 +56,12 @@ typedef union CPUCell {
|
|||
char_type scale: SCALE_BITS;
|
||||
char_type subscale_n: SUBSCALE_BITS;
|
||||
char_type subscale_d: SUBSCALE_BITS;
|
||||
char_type x : WIDTH_BITS + SCALE_BITS + 1;
|
||||
char_type y : SCALE_BITS + 1;
|
||||
char_type x : WIDTH_BITS + SCALE_BITS;
|
||||
char_type y : SCALE_BITS;
|
||||
char_type width: WIDTH_BITS;
|
||||
char_type vertical_align: 3;
|
||||
char_type vertical_align: VALIGN_BITS;
|
||||
char_type temp_flag: 1;
|
||||
char_type : 14;
|
||||
char_type : 17;
|
||||
};
|
||||
struct {
|
||||
char_type ch_and_idx: sizeof(char_type) * 8;
|
||||
|
|
|
|||
|
|
@ -1258,7 +1258,7 @@ screen_handle_multicell_command(Screen *self, const MultiCellCommand *cmd, const
|
|||
CPUCell mcd = {
|
||||
.width=MIN(cmd->width, M(WIDTH_BITS)), .scale=MAX(1u, MIN(cmd->scale, M(SCALE_BITS))),
|
||||
.subscale_n=MIN(cmd->subscale_n, M(SUBSCALE_BITS)), .subscale_d=MIN(cmd->subscale_d, M(SUBSCALE_BITS)),
|
||||
.vertical_align=MIN(cmd->vertical_align, 7u), .is_multicell=true
|
||||
.vertical_align=MIN(cmd->vertical_align, M(VALIGN_BITS)), .is_multicell=true
|
||||
};
|
||||
#undef M
|
||||
if (mcd.width) handle_fixed_width_multicell_command(self, mcd, self->lc);
|
||||
|
|
|
|||
|
|
@ -129,9 +129,14 @@ def comb(x, y):
|
|||
for x in range(1, 3):
|
||||
comb(x, y)
|
||||
comb(0, 1)
|
||||
s = self.create_screen(cols=7 * 7, lines=7)
|
||||
multicell(s, 'a', scale=7, width=7)
|
||||
for y in range(s.lines):
|
||||
for x in range(s.columns):
|
||||
ac(x, y, is_multicell=True, x=x, y=y)
|
||||
|
||||
# Test wrapping
|
||||
s.reset()
|
||||
s = self.create_screen(cols=6, lines=6)
|
||||
s.draw('x' * (s.columns - 1))
|
||||
multicell(s, 'a', scale=2)
|
||||
ac(s.columns - 1, 0, is_multicell=False, text='', next_char_was_wrapped=True)
|
||||
|
|
|
|||
Loading…
Reference in a new issue