Graphics protocol: Add support for giving individual image placements their

Fixes #3133
This commit is contained in:
Kovid Goyal
2020-12-02 05:23:08 +05:30
parent 0173959e64
commit b5e704a934
8 changed files with 116 additions and 53 deletions

View File

@@ -23,6 +23,7 @@ static inline void parse_graphics_code(Screen *screen,
format = 'f',
more = 'm',
id = 'i',
placement_id = 'p',
width = 'w',
height = 'h',
x_offset = 'x',
@@ -69,6 +70,9 @@ static inline void parse_graphics_code(Screen *screen,
case id:
value_state = UINT;
break;
case placement_id:
value_state = UINT;
break;
case width:
value_state = UINT;
break;
@@ -131,8 +135,8 @@ static inline void parse_graphics_code(Screen *screen,
case action: {
g.action = screen->parser_buf[pos++] & 0xff;
if (g.action != 't' && g.action != 'd' && g.action != 'p' &&
g.action != 'q' && g.action != 'T') {
if (g.action != 'p' && g.action != 'q' && g.action != 't' &&
g.action != 'T' && g.action != 'd') {
REPORT_ERROR("Malformed GraphicsCommand control block, unknown flag "
"value for action: 0x%x",
g.action);
@@ -142,14 +146,14 @@ static inline void parse_graphics_code(Screen *screen,
case delete_action: {
g.delete_action = screen->parser_buf[pos++] & 0xff;
if (g.delete_action != 'X' && g.delete_action != 'y' &&
if (g.delete_action != 'p' && g.delete_action != 'q' &&
g.delete_action != 'Z' && g.delete_action != 'x' &&
g.delete_action != 'Q' && g.delete_action != 'C' &&
g.delete_action != 'y' && g.delete_action != 'Y' &&
g.delete_action != 'i' && g.delete_action != 'I' &&
g.delete_action != 'A' && g.delete_action != 'p' &&
g.delete_action != 'Y' && g.delete_action != 'z' &&
g.delete_action != 'a' && g.delete_action != 'P' &&
g.delete_action != 'x' && g.delete_action != 'q' &&
g.delete_action != 'Z' && g.delete_action != 'Q' &&
g.delete_action != 'c' && g.delete_action != 'C') {
g.delete_action != 'a' && g.delete_action != 'z' &&
g.delete_action != 'A' && g.delete_action != 'X' &&
g.delete_action != 'P' && g.delete_action != 'c') {
REPORT_ERROR("Malformed GraphicsCommand control block, unknown flag "
"value for delete_action: 0x%x",
g.delete_action);
@@ -159,8 +163,8 @@ static inline void parse_graphics_code(Screen *screen,
case transmission_type: {
g.transmission_type = screen->parser_buf[pos++] & 0xff;
if (g.transmission_type != 'f' && g.transmission_type != 'd' &&
g.transmission_type != 's' && g.transmission_type != 't') {
if (g.transmission_type != 'd' && g.transmission_type != 'f' &&
g.transmission_type != 't' && g.transmission_type != 's') {
REPORT_ERROR("Malformed GraphicsCommand control block, unknown flag "
"value for transmission_type: 0x%x",
g.transmission_type);
@@ -233,6 +237,7 @@ static inline void parse_graphics_code(Screen *screen,
U(format);
U(more);
U(id);
U(placement_id);
U(width);
U(height);
U(x_offset);
@@ -303,19 +308,21 @@ static inline void parse_graphics_code(Screen *screen,
}
REPORT_VA_COMMAND(
"s {sc sc sc sc sI sI sI sI sI sI sI sI sI sI sI sI sI sI sI si sI} y#",
"s {sc sc sc sc sI sI sI sI sI sI sI sI sI sI sI sI sI sI sI sI si sI} "
"y#",
"graphics_command", "action", g.action, "delete_action", g.delete_action,
"transmission_type", g.transmission_type, "compressed", g.compressed,
"format", (unsigned int)g.format, "more", (unsigned int)g.more, "id",
(unsigned int)g.id, "width", (unsigned int)g.width, "height",
(unsigned int)g.height, "x_offset", (unsigned int)g.x_offset, "y_offset",
(unsigned int)g.y_offset, "data_height", (unsigned int)g.data_height,
"data_width", (unsigned int)g.data_width, "data_sz",
(unsigned int)g.data_sz, "data_offset", (unsigned int)g.data_offset,
"num_cells", (unsigned int)g.num_cells, "num_lines",
(unsigned int)g.num_lines, "cell_x_offset", (unsigned int)g.cell_x_offset,
"cell_y_offset", (unsigned int)g.cell_y_offset, "z_index", (int)g.z_index,
"payload_sz", g.payload_sz, payload, g.payload_sz);
(unsigned int)g.id, "placement_id", (unsigned int)g.placement_id, "width",
(unsigned int)g.width, "height", (unsigned int)g.height, "x_offset",
(unsigned int)g.x_offset, "y_offset", (unsigned int)g.y_offset,
"data_height", (unsigned int)g.data_height, "data_width",
(unsigned int)g.data_width, "data_sz", (unsigned int)g.data_sz,
"data_offset", (unsigned int)g.data_offset, "num_cells",
(unsigned int)g.num_cells, "num_lines", (unsigned int)g.num_lines,
"cell_x_offset", (unsigned int)g.cell_x_offset, "cell_y_offset",
(unsigned int)g.cell_y_offset, "z_index", (int)g.z_index, "payload_sz",
g.payload_sz, payload, g.payload_sz);
screen_handle_graphics_command(screen, &g, payload);
}