Changeset e1f2079 in mainline
- Timestamp:
- 2020-02-14T19:54:40Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- b0a94854
- Parents:
- b252e87
- Location:
- uspace
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/fb/kfb/kfb.h
rb252e87 re1f2079 41 41 #define NAME "kfb" 42 42 43 extern ddf_dev_ops_t graph_vsl_device_ops;44 extern ddf_dev_ops_t graph_rnd_device_ops;45 46 43 #endif 47 44 -
uspace/drv/fb/kfb/port.c
rb252e87 re1f2079 43 43 #include <as.h> 44 44 #include <ddev_srv.h> 45 #include <ddev/info.h> 45 46 #include <ddi.h> 46 47 #include <ddf/log.h> … … 93 94 94 95 static errno_t kfb_ddev_get_gc(void *, sysarg_t *, sysarg_t *); 96 static errno_t kfb_ddev_get_info(void *, ddev_info_t *); 95 97 96 98 static errno_t kfb_gc_set_color(void *, gfx_color_t *); … … 103 105 104 106 static ddev_ops_t kfb_ddev_ops = { 105 .get_gc = kfb_ddev_get_gc 107 .get_gc = kfb_ddev_get_gc, 108 .get_info = kfb_ddev_get_info 106 109 }; 107 110 … … 121 124 *arg2 = ddf_fun_get_handle(kfb->fun); 122 125 *arg3 = 42; 126 return EOK; 127 } 128 129 static errno_t kfb_ddev_get_info(void *arg, ddev_info_t *info) 130 { 131 kfb_t *kfb = (kfb_t *) arg; 132 133 ddev_info_init(info); 134 info->rect = kfb->rect; 123 135 return EOK; 124 136 } -
uspace/lib/gfx/include/gfx/coord.h
rb252e87 re1f2079 42 42 extern void gfx_coord2_add(gfx_coord2_t *, gfx_coord2_t *, gfx_coord2_t *); 43 43 extern void gfx_coord2_subtract(gfx_coord2_t *, gfx_coord2_t *, gfx_coord2_t *); 44 extern void gfx_coord2_clip(gfx_coord2_t *, gfx_rect_t *, gfx_coord2_t *); 44 45 extern void gfx_span_points_sort(gfx_coord_t, gfx_coord_t, gfx_coord_t *, 45 46 gfx_coord_t *); -
uspace/lib/gfx/src/coord.c
rb252e87 re1f2079 62 62 } 63 63 64 void gfx_coord2_clip(gfx_coord2_t *a, gfx_rect_t *clip, gfx_coord2_t *d) 65 { 66 gfx_rect_t sclip; 67 gfx_coord2_t t; 68 69 gfx_rect_points_sort(clip, &sclip); 70 71 t.x = min(a->x, clip->p1.x - 1); 72 t.y = min(a->y, clip->p1.y - 1); 73 74 d->x = max(clip->p0.x, t.x); 75 d->y = max(clip->p0.y, t.y); 76 } 77 64 78 /** Sort points of a span. 65 79 * -
uspace/lib/gfx/test/coord.c
rb252e87 re1f2079 68 68 } 69 69 70 /** gfx_coord2_clip with point to lower-left of clipping rectangle */ 71 PCUT_TEST(coord2_clip_ll) 72 { 73 gfx_coord2_t p; 74 gfx_coord2_t cp; 75 gfx_rect_t rect; 76 77 p.x = 1; 78 p.y = 2; 79 80 rect.p0.x = 3; 81 rect.p0.y = 4; 82 rect.p1.x = 5; 83 rect.p1.y = 6; 84 85 gfx_coord2_clip(&p, &rect, &cp); 86 87 PCUT_ASSERT_INT_EQUALS(3, cp.x); 88 PCUT_ASSERT_INT_EQUALS(4, cp.y); 89 } 90 91 /** gfx_coord2_clip with point inside the clipping rectangle */ 92 PCUT_TEST(coord2_clip_mm) 93 { 94 gfx_coord2_t p; 95 gfx_coord2_t cp; 96 gfx_rect_t rect; 97 98 p.x = 2; 99 p.y = 3; 100 101 rect.p0.x = 1; 102 rect.p0.y = 2; 103 rect.p1.x = 3; 104 rect.p1.y = 4; 105 106 gfx_coord2_clip(&p, &rect, &cp); 107 108 PCUT_ASSERT_INT_EQUALS(2, cp.x); 109 PCUT_ASSERT_INT_EQUALS(3, cp.y); 110 } 111 112 /** gfx_coord2_clip with point to upper-right of clipping rectangle */ 113 PCUT_TEST(coord2_clip_hh) 114 { 115 gfx_coord2_t p; 116 gfx_coord2_t cp; 117 gfx_rect_t rect; 118 119 p.x = 5; 120 p.y = 6; 121 122 rect.p0.x = 1; 123 rect.p0.y = 2; 124 rect.p1.x = 3; 125 rect.p1.y = 4; 126 127 gfx_coord2_clip(&p, &rect, &cp); 128 129 PCUT_ASSERT_INT_EQUALS(2, cp.x); 130 PCUT_ASSERT_INT_EQUALS(3, cp.y); 131 } 132 70 133 /** gfx_rect_translate should translate rectangle */ 71 134 PCUT_TEST(rect_translate) -
uspace/srv/hid/display/ddev.c
rb252e87 re1f2079 37 37 #include <ddev.h> 38 38 #include <errno.h> 39 #include <io/log.h> 39 40 #include <stdio.h> 40 41 #include <stdlib.h> … … 53 54 { 54 55 ds_ddev_t *ddev; 56 ddev_info_t info; 55 57 gfx_context_t *gc; 56 58 ddev_t *dd = NULL; … … 71 73 return rc; 72 74 } 75 76 rc = ddev_get_info(dd, &info); 77 if (rc != EOK) { 78 printf("Error getting information for display device '%s'.\n", 79 name); 80 free(name); 81 ddev_close(dd); 82 return rc; 83 } 84 85 log_msg(LOG_DEFAULT, LVL_NOTE, "Device rectangle for '%s': " 86 "%d,%d,%d,%d\n", name, info.rect.p0.x, info.rect.p0.y, 87 info.rect.p1.x, info.rect.p1.y); 73 88 74 89 rc = ddev_get_gc(dd, &gc); … … 91 106 ddev->dd = dd; 92 107 ddev->gc = gc; 108 ddev->info = info; 93 109 94 110 ds_display_add_ddev(display, ddev); -
uspace/srv/hid/display/display.c
rb252e87 re1f2079 384 384 assert(!link_used(&ddev->lddevs)); 385 385 386 /* Set display dimensions to dimensions of first display device */ 387 if (gfx_rect_is_empty(&disp->rect)) 388 disp->rect = ddev->info.rect; 389 386 390 ddev->display = disp; 387 391 list_append(&ddev->lddevs, &disp->ddevs); … … 447 451 errno_t ds_display_paint_bg(ds_display_t *disp, gfx_rect_t *rect) 448 452 { 449 gfx_rect_t dsrect;450 453 gfx_rect_t crect; 451 454 gfx_context_t *gc; 452 455 errno_t rc; 453 456 454 dsrect.p0.x = 0;455 dsrect.p0.y = 0;456 dsrect.p1.x = 1024;457 dsrect.p1.y = 768;458 459 457 if (rect != NULL) 460 gfx_rect_clip(&d srect, rect, &crect);458 gfx_rect_clip(&disp->rect, rect, &crect); 461 459 else 462 crect = d srect;460 crect = disp->rect; 463 461 464 462 gc = ds_display_get_gc(disp); // XXX -
uspace/srv/hid/display/seat.c
rb252e87 re1f2079 253 253 errno_t ds_seat_post_ptd_event(ds_seat_t *seat, ptd_event_t *event) 254 254 { 255 ds_display_t *disp = seat->display; 255 256 gfx_coord2_t npos; 256 257 ds_window_t *wnd; … … 287 288 288 289 gfx_coord2_add(&seat->pntpos, &event->dmove, &npos); 289 if (npos.x < 0) 290 npos.x = 0; 291 if (npos.y < 0) 292 npos.y = 0; 293 if (npos.x > 1024) 294 npos.x = 1024; 295 if (npos.y > 768) 296 npos.y = 768; 290 gfx_coord2_clip(&npos, &disp->rect, &npos); 297 291 298 292 printf("clear pointer\n"); -
uspace/srv/hid/display/types/display/ddev.h
rb252e87 re1f2079 52 52 /** Device GC */ 53 53 gfx_context_t *gc; 54 /** Display device information */ 55 ddev_info_t info; 54 56 /** Service ID */ 55 57 service_id_t svc_id; -
uspace/srv/hid/display/types/display/display.h
rb252e87 re1f2079 39 39 #include <adt/list.h> 40 40 #include <gfx/color.h> 41 #include <gfx/coord.h> 41 42 #include <io/input.h> 42 43 #include "window.h" … … 69 70 /** Background color */ 70 71 gfx_color_t *bg_color; 72 73 /** Bounding rectangle */ 74 gfx_rect_t rect; 71 75 } ds_display_t; 72 76 -
uspace/srv/hid/rfb/main.c
rb252e87 re1f2079 27 27 */ 28 28 29 #include <ddev/info.h> 29 30 #include <ddev_srv.h> 30 31 #include <errno.h> … … 46 47 #define NAME "rfb" 47 48 49 static errno_t rfb_ddev_get_gc(void *, sysarg_t *, sysarg_t *); 50 static errno_t rfb_ddev_get_info(void *, ddev_info_t *); 51 48 52 static errno_t rfb_gc_set_color(void *, gfx_color_t *); 49 53 static errno_t rfb_gc_fill_rect(void *, gfx_rect_t *); … … 55 59 56 60 static ddev_ops_t rfb_ddev_ops = { 61 .get_gc = rfb_ddev_get_gc, 62 .get_info = rfb_ddev_get_info 57 63 }; 58 64 … … 103 109 rfb->damage_rect.width = new_rect.p1.x - new_rect.p0.x; 104 110 rfb->damage_rect.height = new_rect.p1.y - new_rect.p1.y; 111 } 112 113 static errno_t rfb_ddev_get_gc(void *arg, sysarg_t *arg2, sysarg_t *arg3) 114 { 115 *arg2 = 0; 116 *arg3 = 42; 117 return EOK; 118 } 119 120 static errno_t rfb_ddev_get_info(void *arg, ddev_info_t *info) 121 { 122 rfb_t *rfb = (rfb_t *) arg; 123 124 ddev_info_init(info); 125 126 info->rect.p0.x = 0; 127 info->rect.p0.y = 0; 128 info->rect.p1.x = rfb->width; 129 info->rect.p1.y = rfb->height; 130 131 return EOK; 105 132 } 106 133 … … 284 311 static void client_connection(ipc_call_t *icall, void *arg) 285 312 { 313 rfb_t *rfb = (rfb_t *) arg; 286 314 ddev_srv_t srv; 287 315 sysarg_t svc_id; … … 295 323 ddev_srv_initialize(&srv); 296 324 srv.ops = &rfb_ddev_ops; 297 srv.arg = arg;325 srv.arg = (void *) rfb; 298 326 299 327 /* Handle connection */ 300 328 ddev_conn(icall, &srv); 301 329 } else { 302 rc = gfx_context_new(&rfb_gc_ops, arg, &gc);330 rc = gfx_context_new(&rfb_gc_ops, (void *) rfb, &gc); 303 331 if (rc != EOK) { 304 332 async_answer_0(icall, ENOMEM);
Note:
See TracChangeset
for help on using the changeset viewer.