Changeset 1601f3c in mainline for uspace/srv/console/screenbuffer.c
- Timestamp:
- 2009-05-21T15:32:42Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 7d158097
- Parents:
- a095d20
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/console/screenbuffer.c
ra095d20 r1601f3c 28 28 29 29 /** @addtogroup console 30 * @{ 30 * @{ 31 31 */ 32 32 /** @file … … 38 38 #include <unistd.h> 39 39 40 /** Store one character to screenbuffer. Its position is determined by 41 * scr->position_x and scr->position_y. 40 /** Store one character to screenbuffer. 42 41 * 43 * @param scr screenbuffer 44 * @param c stored character 42 * Its position is determined by scr->position_x 43 * and scr->position_y. 44 * 45 * @param scr Screenbuffer 46 * @param c Stored character 47 * 45 48 */ 46 49 void screenbuffer_putchar(screenbuffer_t *scr, wchar_t ch) 47 50 { 48 keyfield_t *field; 49 50 field = get_field_at(scr, scr->position_x, scr->position_y); 51 51 keyfield_t *field = 52 get_field_at(scr, scr->position_x, scr->position_y); 53 52 54 field->character = ch; 53 55 field->attrs = scr->attrs; 54 56 } 55 57 56 /** Initilize screenbuffer. Allocate space for screen content in accordance to given size. 57 * @param scr initialized screenbuffer 58 * @param size_x width in characters 59 * @param size_y height in characters 60 * @return pointer to screenbuffer (same as scr parameter) or NULL 58 /** Initilize screenbuffer. 59 * 60 * Allocate space for screen content in accordance to given size. 61 * 62 * @param scr Initialized screenbuffer 63 * @param size_x Width in characters 64 * @param size_y Height in characters 65 * 66 * @return Pointer to screenbuffer (same as scr parameter) or NULL 67 * 61 68 */ 62 69 screenbuffer_t *screenbuffer_init(screenbuffer_t *scr, int size_x, int size_y) 63 70 { 64 71 scr->buffer = (keyfield_t *) malloc(sizeof(keyfield_t) * size_x * size_y); 65 if (!scr->buffer) {72 if (!scr->buffer) 66 73 return NULL; 67 }68 74 69 75 scr->size_x = size_x; … … 78 84 } 79 85 80 /** Clear screenbuffer. 81 * @param scr screenbuffer 86 /** Clear screenbuffer. 87 * 88 * @param scr Screenbuffer 89 * 82 90 */ 83 91 void screenbuffer_clear(screenbuffer_t *scr) … … 89 97 scr->buffer[i].attrs = scr->attrs; 90 98 } 91 99 92 100 scr->top_line = 0; 93 101 scr->position_y = 0; … … 96 104 97 105 /** Clear one buffer line. 106 * 98 107 * @param scr 99 108 * @param line One buffer line (not a screen line!) 109 * 100 110 */ 101 111 void screenbuffer_clear_line(screenbuffer_t *scr, unsigned int line) … … 110 120 111 121 /** Copy content buffer from screenbuffer to given memory. 112 * @param scr source screenbuffer 113 * @param dest destination 122 * 123 * @param scr Source screenbuffer 124 * @param dest Destination 125 * 114 126 */ 115 127 void screenbuffer_copy_buffer(screenbuffer_t *scr, keyfield_t *dest) … … 117 129 unsigned int i; 118 130 119 for (i = 0; i < scr->size_x * scr->size_y; i++) {131 for (i = 0; i < scr->size_x * scr->size_y; i++) 120 132 dest[i] = scr->buffer[i]; 121 }122 133 } 123 134 124 135 /** Set new cursor position in screenbuffer. 136 * 125 137 * @param scr 126 138 * @param x 127 139 * @param y 140 * 128 141 */ 129 142 void screenbuffer_goto(screenbuffer_t *scr, unsigned int x, unsigned int y) … … 134 147 135 148 /** Set new style. 149 * 136 150 * @param scr 137 151 * @param fg_color 138 152 * @param bg_color 153 * 139 154 */ 140 155 void screenbuffer_set_style(screenbuffer_t *scr, int style) … … 145 160 146 161 /** Set new color. 162 * 147 163 * @param scr 148 164 * @param fg_color 149 165 * @param bg_color 166 * 150 167 */ 151 168 void screenbuffer_set_color(screenbuffer_t *scr, unsigned int fg_color, unsigned int bg_color, unsigned int flags) … … 158 175 159 176 /** Set new RGB color. 177 * 160 178 * @param scr 161 179 * @param fg_color 162 180 * @param bg_color 181 * 163 182 */ 164 183 void screenbuffer_set_rgb_color(screenbuffer_t *scr, unsigned int fg_color, unsigned int bg_color) … … 169 188 } 170 189 171 172 190 /** @} 173 191 */
Note:
See TracChangeset
for help on using the changeset viewer.