Add set_rect, use it in clear.

This commit is contained in:
Michael Jumper 2013-03-24 18:05:15 -07:00
parent 96b12c7722
commit a102ba4a86
2 changed files with 21 additions and 9 deletions

View File

@ -419,6 +419,13 @@ void guac_terminal_delta_copy(guac_terminal_delta* delta,
int src_row, int src_column, int src_row, int src_column,
int w, int h); int w, int h);
/**
* Sets a rectangle of character data to the given character value.
*/
void guac_terminal_delta_set_rect(guac_terminal_delta* delta,
int row, int column, int w, int h,
guac_terminal_char* character);
/** /**
* Flushes all pending operations within the given guac_client_delta to the * Flushes all pending operations within the given guac_client_delta to the
* given guac_terminal. * given guac_terminal.

View File

@ -412,18 +412,17 @@ int guac_terminal_copy(guac_terminal* term,
int guac_terminal_clear(guac_terminal* term, int guac_terminal_clear(guac_terminal* term,
int row, int col, int rows, int cols, int background_color) { int row, int col, int rows, int cols, int background_color) {
guac_socket* socket = term->client->socket; /* Build space */
const guac_terminal_color* color = guac_terminal_char character;
&guac_terminal_palette[background_color]; character.value = ' ';
character.attributes.reverse = false;
character.attributes.background = background_color;
/* Fill with color */ /* Fill with color */
return guac_terminal_delta_set_rect(term->delta,
guac_protocol_send_rect(socket, GUAC_DEFAULT_LAYER, row, col, cols, rows, &character);
col * term->char_width, row * term->char_height,
cols * term->char_width, rows * term->char_height)
|| guac_protocol_send_cfill(socket, GUAC_COMP_OVER, GUAC_DEFAULT_LAYER, return 0;
color->red, color->green, color->blue, 255);
} }
@ -571,6 +570,12 @@ void guac_terminal_delta_copy(guac_terminal_delta* delta,
/* STUB */ /* STUB */
} }
void guac_terminal_delta_set_rect(guac_terminal_delta* delta,
int row, int column, int w, int h,
guac_terminal_char* character) {
/* STUB */
}
void guac_terminal_delta_flush(guac_terminal_delta* delta, void guac_terminal_delta_flush(guac_terminal_delta* delta,
guac_terminal* terminal) { guac_terminal* terminal) {
/* STUB */ /* STUB */