Changeset fb420e48 in mainline
- Timestamp:
- 2019-12-16T13:47:33Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8e9781f
- Parents:
- c2250702
- git-author:
- Jiri Svoboda <jiri@…> (2019-12-15 13:47:28)
- git-committer:
- Jiri Svoboda <jiri@…> (2019-12-16 13:47:33)
- Location:
- uspace
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/display/include/display/wndparams.h
rc2250702 rfb420e48 40 40 extern void display_wnd_params_init(display_wnd_params_t *); 41 41 42 43 42 #endif 44 43 -
uspace/lib/gfx/include/gfx/coord.h
rc2250702 rfb420e48 50 50 extern void gfx_rect_points_sort(gfx_rect_t *, gfx_rect_t *); 51 51 extern bool gfx_rect_is_empty(gfx_rect_t *); 52 extern bool gfx_pix_inside_rect(gfx_coord2_t *, gfx_rect_t *); 52 53 53 54 #endif -
uspace/lib/gfx/src/coord.c
rc2250702 rfb420e48 189 189 } 190 190 191 /** Return true if pixel at coordinate @a coord lies within rectangle @a rect. */ 192 bool gfx_pix_inside_rect(gfx_coord2_t *coord, gfx_rect_t *rect) 193 { 194 gfx_rect_t sr; 195 196 gfx_rect_points_sort(rect, &sr); 197 198 if (coord->x < sr.p0.x || coord->y < sr.p0.y) 199 return false; 200 201 if (coord->x >= sr.p1.x || coord->y >= sr.p1.y) 202 return false; 203 204 return true; 205 } 206 191 207 /** @} 192 208 */ -
uspace/lib/gfx/test/coord.c
rc2250702 rfb420e48 524 524 } 525 525 526 /** gfx_pix_inside_rect for */ 527 PCUT_TEST(pix_inside_rect) 528 { 529 gfx_coord2_t coord; 530 gfx_rect_t rect; 531 532 rect.p0.x = 1; 533 rect.p0.y = 2; 534 rect.p1.x = 3; 535 rect.p1.y = 4; 536 537 coord.x = 0; 538 coord.y = 1; 539 PCUT_ASSERT_FALSE(gfx_pix_inside_rect(&coord, &rect)); 540 541 coord.x = 1; 542 coord.y = 1; 543 PCUT_ASSERT_FALSE(gfx_pix_inside_rect(&coord, &rect)); 544 545 coord.x = 0; 546 coord.y = 2; 547 PCUT_ASSERT_FALSE(gfx_pix_inside_rect(&coord, &rect)); 548 549 coord.x = 1; 550 coord.y = 2; 551 PCUT_ASSERT_TRUE(gfx_pix_inside_rect(&coord, &rect)); 552 553 coord.x = 2; 554 coord.y = 3; 555 PCUT_ASSERT_TRUE(gfx_pix_inside_rect(&coord, &rect)); 556 557 coord.x = 3; 558 coord.y = 3; 559 PCUT_ASSERT_FALSE(gfx_pix_inside_rect(&coord, &rect)); 560 561 coord.x = 2; 562 coord.y = 4; 563 PCUT_ASSERT_FALSE(gfx_pix_inside_rect(&coord, &rect)); 564 565 coord.x = 3; 566 coord.y = 4; 567 PCUT_ASSERT_FALSE(gfx_pix_inside_rect(&coord, &rect)); 568 } 569 526 570 PCUT_EXPORT(coord); -
uspace/srv/hid/display/display.c
rc2250702 rfb420e48 172 172 { 173 173 ds_window_t *wnd; 174 gfx_rect_t drect; 174 175 175 176 wnd = ds_display_first_window(display); 176 177 while (wnd != NULL) { 177 // XXX Need to know window dimensions 178 if (pos->x >= wnd->dpos.x && pos->y >= wnd->dpos.y && 179 pos->x <= wnd->dpos.x + 100 && pos->y <= wnd->dpos.y + 100) { 178 /* Window bounding rectangle on display */ 179 gfx_rect_translate(&wnd->dpos, &wnd->rect, &drect); 180 181 if (gfx_pix_inside_rect(pos, &drect)) 180 182 return wnd; 181 }182 183 183 184 wnd = ds_display_next_window(wnd);
Note:
See TracChangeset
for help on using the changeset viewer.