Changeset 32e7411 in mainline
- Timestamp:
- 2010-05-04T15:48:49Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5e16832f
- Parents:
- 53e197f
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/fb/serial_console.c
r53e197f r32e7411 84 84 SGR_RESET = 0, 85 85 SGR_BOLD = 1, 86 SGR_UNDERLINE = 4, 86 87 SGR_BLINK = 5, 87 88 SGR_REVERSE = 7, 88 SGR_NORMAL_INT = 22,89 SGR_BLINK_OFF = 25,90 SGR_REVERSE_OFF = 27,91 89 SGR_FGCOLOR = 30, 92 90 SGR_BGCOLOR = 40 … … 153 151 switch (style) { 154 152 case STYLE_EMPHASIS: 153 serial_sgr(SGR_RESET); 155 154 if (color) { 156 serial_sgr(SGR_RESET);157 155 serial_sgr(SGR_FGCOLOR + CI_RED); 158 156 serial_sgr(SGR_BGCOLOR + CI_WHITE); … … 161 159 break; 162 160 case STYLE_INVERTED: 161 serial_sgr(SGR_RESET); 163 162 if (color) { 164 serial_sgr(SGR_RESET);165 163 serial_sgr(SGR_FGCOLOR + CI_WHITE); 166 164 serial_sgr(SGR_BGCOLOR + CI_BLACK); 167 serial_sgr(SGR_NORMAL_INT);168 165 } else 169 166 serial_sgr(SGR_REVERSE); 170 167 break; 171 168 case STYLE_SELECTED: 169 serial_sgr(SGR_RESET); 172 170 if (color) { 173 serial_sgr(SGR_RESET);174 171 serial_sgr(SGR_FGCOLOR + CI_WHITE); 175 172 serial_sgr(SGR_BGCOLOR + CI_RED); 176 serial_sgr(SGR_NORMAL_INT); 177 } else { 178 serial_sgr(SGR_BOLD); 179 serial_sgr(SGR_REVERSE); 180 } 173 } else 174 serial_sgr(SGR_UNDERLINE); 181 175 break; 182 176 default: 177 serial_sgr(SGR_RESET); 183 178 if (color) { 184 serial_sgr(SGR_RESET);185 179 serial_sgr(SGR_FGCOLOR + CI_BLACK); 186 180 serial_sgr(SGR_BGCOLOR + CI_WHITE); 187 181 } 188 serial_sgr(SGR_NORMAL_INT);189 182 } 190 183 } … … 193 186 uint8_t flags) 194 187 { 188 serial_sgr(SGR_RESET); 195 189 if (color) { 196 serial_sgr(SGR_RESET); 197 serial_sgr(SGR_FGCOLOR + color_map[fgcolor]); 198 serial_sgr(SGR_BGCOLOR + color_map[bgcolor]); 190 serial_sgr(SGR_FGCOLOR + color_map[fgcolor & 7]); 191 serial_sgr(SGR_BGCOLOR + color_map[bgcolor & 7]); 192 if (flags & CATTR_BRIGHT) 193 serial_sgr(SGR_BOLD); 199 194 } else { 200 if (fgcolor < bgcolor) 201 serial_sgr(SGR_RESET); 202 else 195 if (fgcolor >= bgcolor) 203 196 serial_sgr(SGR_REVERSE); 204 } 197 } 205 198 } 206 199 … … 209 202 serial_sgr(SGR_RESET); 210 203 211 if (fgcolor < bgcolor) 212 serial_sgr(SGR_REVERSE_OFF); 213 else 204 if (fgcolor >= bgcolor) 214 205 serial_sgr(SGR_REVERSE); 215 206 } … … 283 274 } 284 275 285 286 287 276 /** Draw text data to viewport. 288 277 * 289 * @param vport Viewport id290 * @param data Text data.291 * @param x Leftmost column of the area.292 * @param y Topmost row of the area.293 * @param w 294 * @param h 278 * @param vport Viewport id 279 * @param data Text data. 280 * @param x0 Leftmost column of the area. 281 * @param y0 Topmost row of the area. 282 * @param width Number of rows. 283 * @param height Number of columns. 295 284 * 296 285 */ 297 static void draw_text_data(keyfield_t *data, ipcarg_t x, ipcarg_t y, 298 ipcarg_t w, ipcarg_t h) 299 { 300 serial_goto(x, y); 301 ipcarg_t i; 302 ipcarg_t j; 303 286 static void draw_text_data(keyfield_t *data, ipcarg_t x0, ipcarg_t y0, 287 ipcarg_t width, ipcarg_t height) 288 { 304 289 attrs_t *a0 = &data[0].attrs; 305 306 for (j = 0; j < h; j++) { 307 if ((j > 0) && (w != scr_width)) 308 serial_goto(x, j); 290 serial_set_attrs(a0); 291 292 ipcarg_t y; 293 for (y = 0; y < height; y++) { 294 serial_goto(x0, y0 + y); 309 295 310 for (i = 0; i < w; i++) { 311 attrs_t *a1 = &data[j * w + i].attrs; 312 313 if (!attrs_same(*a0, *a1)) { 314 serial_set_attrs(a1); 315 a0 = a1; 296 ipcarg_t x; 297 for (x = 0; x < width; x++) { 298 attrs_t *attr = &data[y * width + x].attrs; 299 300 if (!attrs_same(*a0, *attr)) { 301 serial_set_attrs(attr); 302 a0 = attr; 316 303 } 317 304 318 serial_putchar(data[ j * w + i].character);305 serial_putchar(data[y * width + x].character); 319 306 } 320 307 }
Note:
See TracChangeset
for help on using the changeset viewer.