Changeset 2012fe0 in mainline
- Timestamp:
- 2020-01-21T15:04:53Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 28db46b
- Parents:
- c79545e
- git-author:
- Jiri Svoboda <jiri@…> (2020-01-20 19:04:50)
- git-committer:
- Jiri Svoboda <jiri@…> (2020-01-21 15:04:53)
- Location:
- uspace/srv/hid/display
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/display.c
rc79545e r2012fe0 236 236 } 237 237 238 /** Get last window in display. 239 * 240 * @param display Display 241 * @return Last window or @c NULL if there is none 242 */ 243 ds_window_t *ds_display_last_window(ds_display_t *display) 244 { 245 link_t *link = list_last(&display->windows); 246 247 if (link == NULL) 248 return NULL; 249 250 return list_get_instance(link, ds_window_t, ldwindows); 251 } 252 238 253 /** Get next window in client. 239 254 * … … 244 259 { 245 260 link_t *link = list_next(&wnd->ldwindows, &wnd->display->windows); 261 262 if (link == NULL) 263 return NULL; 264 265 return list_get_instance(link, ds_window_t, ldwindows); 266 } 267 268 /** Get previous window in client. 269 * 270 * @param wnd Current window 271 * @return Previous window or @c NULL if there is none 272 */ 273 ds_window_t *ds_display_prev_window(ds_window_t *wnd) 274 { 275 link_t *link = list_prev(&wnd->ldwindows, &wnd->display->windows); 246 276 247 277 if (link == NULL) … … 441 471 } 442 472 473 /** Paint display. 474 * 475 * @param display Display 476 * @param rect Bounding rectangle or @c NULL to repaint entire display 477 */ 478 errno_t ds_display_paint(ds_display_t *disp, gfx_rect_t *rect) 479 { 480 errno_t rc; 481 ds_window_t *wnd; 482 483 /* Paint background */ 484 rc = ds_display_paint_bg(disp, rect); 485 if (rc != EOK) 486 return rc; 487 488 /* Paint windows bottom to top */ 489 wnd = ds_display_last_window(disp); 490 while (wnd != NULL) { 491 rc = ds_window_paint(wnd, rect); 492 if (rc != EOK) 493 return rc; 494 495 wnd = ds_display_prev_window(wnd); 496 } 497 498 return EOK; 499 } 500 443 501 /** @} 444 502 */ -
uspace/srv/hid/display/display.h
rc79545e r2012fe0 58 58 extern void ds_display_remove_window(ds_window_t *); 59 59 extern ds_window_t *ds_display_first_window(ds_display_t *); 60 extern ds_window_t *ds_display_last_window(ds_display_t *); 60 61 extern ds_window_t *ds_display_next_window(ds_window_t *); 62 extern ds_window_t *ds_display_prev_window(ds_window_t *); 61 63 extern errno_t ds_display_post_kbd_event(ds_display_t *, kbd_event_t *); 62 64 extern errno_t ds_display_post_ptd_event(ds_display_t *, ptd_event_t *); … … 71 73 extern gfx_context_t *ds_display_get_gc(ds_display_t *); 72 74 extern errno_t ds_display_paint_bg(ds_display_t *, gfx_rect_t *); 75 extern errno_t ds_display_paint(ds_display_t *, gfx_rect_t *); 73 76 74 77 #endif -
uspace/srv/hid/display/test/display.c
rc79545e r2012fe0 128 128 PCUT_ASSERT_NULL(wnd); 129 129 130 wnd = ds_display_last_window(disp); 131 PCUT_ASSERT_EQUALS(w1, wnd); 132 133 wnd = ds_display_prev_window(wnd); 134 PCUT_ASSERT_EQUALS(w0, wnd); 135 136 wnd = ds_display_prev_window(wnd); 137 PCUT_ASSERT_NULL(wnd); 138 130 139 wnd = ds_display_find_window(disp, w0->id); 131 140 PCUT_ASSERT_EQUALS(w0, wnd); -
uspace/srv/hid/display/window.c
rc79545e r2012fe0 348 348 } 349 349 350 /** Repaint a window using its backing bitmap. 351 * 352 * @param wnd Window to repaint 353 * @return EOK on success or an error code 354 */ 355 static errno_t ds_window_repaint(ds_window_t *wnd) 356 { 357 log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_start_repaint"); 358 return gfx_bitmap_render(wnd->bitmap, NULL, &wnd->dpos); 350 /** Paint a window using its backing bitmap. 351 * 352 * @param wnd Window to paint 353 * @param rect Display rectangle to paint to 354 * @return EOK on success or an error code 355 */ 356 errno_t ds_window_paint(ds_window_t *wnd, gfx_rect_t *rect) 357 { 358 gfx_rect_t srect; 359 gfx_rect_t *brect; 360 gfx_rect_t crect; 361 362 log_msg(LOG_DEFAULT, LVL_DEBUG, "ds_window_paint"); 363 364 if (rect != NULL) { 365 gfx_rect_rtranslate(&wnd->dpos, rect, &srect); 366 367 /* Determine if we have anything to do */ 368 gfx_rect_clip(&srect, rect, &crect); 369 if (gfx_rect_is_empty(&crect)) 370 return EOK; 371 372 brect = &srect; 373 } else { 374 brect = NULL; 375 } 376 377 return gfx_bitmap_render(wnd->bitmap, brect, &wnd->dpos); 359 378 } 360 379 … … 399 418 wnd->state = dsw_idle; 400 419 401 (void) ds_ window_repaint(wnd);420 (void) ds_display_paint(wnd->display, NULL); 402 421 } 403 422 -
uspace/srv/hid/display/window.h
rc79545e r2012fe0 40 40 #include <io/pos_event.h> 41 41 #include <types/gfx/context.h> 42 #include <types/gfx/coord.h> 42 43 #include <types/gfx/ops/context.h> 43 44 #include "types/display/display.h" … … 51 52 extern void ds_window_destroy(ds_window_t *); 52 53 extern gfx_context_t *ds_window_get_ctx(ds_window_t *); 54 extern errno_t ds_window_paint(ds_window_t *, gfx_rect_t *); 53 55 extern errno_t ds_window_post_pos_event(ds_window_t *, pos_event_t *); 54 56
Note:
See TracChangeset
for help on using the changeset viewer.