Changeset 4d8002d in mainline for uspace/srv/hid/display/seat.c
- Timestamp:
- 2020-05-15T16:18:51Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 4912dd59
- Parents:
- 6feccae
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/seat.c
r6feccae r4d8002d 40 40 #include <stdlib.h> 41 41 #include "client.h" 42 #include "cursor.h" 42 43 #include "display.h" 43 44 #include "seat.h" … … 61 62 seat->pntpos.x = 0; 62 63 seat->pntpos.y = 0; 64 65 seat->cursor = display->cursor[dcurs_arrow]; 63 66 64 67 *rseat = seat; … … 142 145 } 143 146 144 /** Draw cross at seat pointer position.145 *146 * @param seat Seat147 * @param len Cross length148 * @param w Cross extra width149 * @param color Color150 *151 * @return EOK on success or an error code152 */153 static errno_t ds_seat_draw_cross(ds_seat_t *seat, gfx_coord_t len,154 gfx_coord_t w, gfx_color_t *color)155 {156 gfx_context_t *gc;157 gfx_rect_t rect, r0;158 errno_t rc;159 160 gc = ds_display_get_gc(seat->display);161 if (gc == NULL)162 return EOK;163 164 rc = gfx_set_color(gc, color);165 if (rc != EOK)166 goto error;167 168 r0.p0.x = -len;169 r0.p0.y = -w;170 r0.p1.x = +len + 1;171 r0.p1.y = +w + 1;172 gfx_rect_translate(&seat->pntpos, &r0, &rect);173 174 rc = gfx_fill_rect(gc, &rect);175 if (rc != EOK)176 goto error;177 178 r0.p0.x = -w;179 r0.p0.y = -len;180 r0.p1.x = +w + 1;181 r0.p1.y = +len + 1;182 gfx_rect_translate(&seat->pntpos, &r0, &rect);183 184 rc = gfx_fill_rect(gc, &rect);185 if (rc != EOK)186 goto error;187 188 return EOK;189 error:190 return rc;191 }192 193 147 /** Draw seat pointer 194 148 * … … 199 153 static errno_t ds_seat_draw_pointer(ds_seat_t *seat) 200 154 { 201 errno_t rc; 202 gfx_color_t *black = NULL; 203 gfx_color_t *white; 204 205 rc = gfx_color_new_rgb_i16(0, 0, 0, &black); 206 if (rc != EOK) 207 goto error; 208 209 rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &white); 210 if (rc != EOK) 211 goto error; 212 213 rc = ds_seat_draw_cross(seat, 8, 1, black); 214 if (rc != EOK) 215 goto error; 216 217 rc = ds_seat_draw_cross(seat, 8, 0, white); 218 if (rc != EOK) 219 goto error; 220 221 gfx_color_delete(black); 222 gfx_color_delete(white); 223 224 return EOK; 225 error: 226 if (black != NULL) 227 gfx_color_delete(black); 228 if (white != NULL) 229 gfx_color_delete(white); 230 return rc; 155 return ds_cursor_paint(seat->cursor, &seat->pntpos); 231 156 } 232 157 … … 241 166 gfx_rect_t rect; 242 167 243 rect.p0.x = seat->pntpos.x - 8; 244 rect.p0.y = seat->pntpos.y - 8; 245 rect.p1.x = seat->pntpos.x + 8 + 1; 246 rect.p1.y = seat->pntpos.y + 8 + 1; 247 168 /* Get rectangle covered by cursor */ 169 ds_cursor_get_rect(seat->cursor, &seat->pntpos, &rect); 170 171 /* Repaint it */ 248 172 return ds_display_paint(seat->display, &rect); 249 173 }
Note:
See TracChangeset
for help on using the changeset viewer.