Changeset 65160d7 in mainline
- Timestamp:
- 2019-12-16T12:32:03Z (5 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c2250702
- Parents:
- 3434233
- git-author:
- Jiri Svoboda <jiri@…> (2019-12-15 12:31:56)
- git-committer:
- Jiri Svoboda <jiri@…> (2019-12-16 12:32:03)
- Location:
- uspace/srv/hid/display
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/srv/hid/display/types/display/window.h
r3434233 r65160d7 80 80 /** Display bitmap */ 81 81 gfx_bitmap_t *bitmap; 82 /** Bounding rectangle */ 83 gfx_rect_t rect; 82 84 } ds_window_bitmap_t; 83 85 -
uspace/srv/hid/display/window.c
r3434233 r65160d7 92 92 { 93 93 ds_window_t *wnd = (ds_window_t *) arg; 94 gfx_rect_t crect; 94 95 gfx_rect_t drect; 95 96 96 97 log_msg(LOG_DEFAULT, LVL_NOTE, "gc_fill_rect"); 97 gfx_rect_translate(&wnd->dpos, rect, &drect); 98 gfx_rect_clip(rect, &wnd->rect, &crect); 99 gfx_rect_translate(&wnd->dpos, &crect, &drect); 98 100 return gfx_fill_rect(ds_display_get_gc(wnd->display), &drect); 99 101 } … … 124 126 125 127 cbm->wnd = wnd; 128 cbm->rect = params->rect; 126 129 *rbm = (void *)cbm; 127 130 return EOK; … … 158 161 ds_window_bitmap_t *cbm = (ds_window_bitmap_t *)bm; 159 162 gfx_coord2_t doffs; 160 161 if (offs0 != NULL) 162 gfx_coord2_add(&cbm->wnd->dpos, offs0, &doffs); 163 else 164 doffs = cbm->wnd->dpos; 163 gfx_coord2_t offs; 164 gfx_rect_t srect; 165 gfx_rect_t swrect; 166 gfx_rect_t crect; 167 168 if (srect0 != NULL) { 169 /* Clip source rectangle to bitmap rectangle */ 170 gfx_rect_clip(srect0, &cbm->rect, &srect); 171 } else { 172 /* Source is entire bitmap rectangle */ 173 srect = cbm->rect; 174 } 175 176 if (offs0 != NULL) { 177 offs = *offs0; 178 } else { 179 offs.x = 0; 180 offs.y = 0; 181 } 182 183 /* Transform window rectangle back to bitmap coordinate system */ 184 gfx_rect_rtranslate(&offs, &cbm->wnd->rect, &swrect); 185 186 /* Clip so that transformed rectangle will be inside the window */ 187 gfx_rect_clip(&srect, &swrect, &crect); 188 189 /* Offset for rendering on screen = window pos + offs */ 190 gfx_coord2_add(&cbm->wnd->dpos, &offs, &doffs); 165 191 166 192 return gfx_bitmap_render(cbm->bitmap, srect0, &doffs);
Note:
See TracChangeset
for help on using the changeset viewer.