Changeset 266ec54 in mainline for uspace/lib/gfx/src/coord.c


Ignore:
Timestamp:
2020-11-28T23:06:31Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
db3c6795
Parents:
554a5f1
git-author:
Jiri Svoboda <jiri@…> (2020-11-27 22:30:28)
git-committer:
Jiri Svoboda <jiri@…> (2020-11-28 23:06:31)
Message:

Viewer fullsreen mode

Fullscreen window placement is more of a stopgap. Proper
solution would probably be via maximizing the window.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/gfx/src/coord.c

    r554a5f1 r266ec54  
    238238}
    239239
     240/** Center rectangle on rectangle.
     241 *
     242 * Translate rectangle @a a so that its center coincides with the
     243 * center of rectangle @a b, saving the result in @a dest.
     244 *
     245 * @param a Rectnagle to translate
     246 * @param b Rectangle on which to center
     247 * @param dest Place to store resulting rectangle
     248 */
     249void gfx_rect_ctr_on_rect(gfx_rect_t *a, gfx_rect_t *b, gfx_rect_t *dest)
     250{
     251        gfx_coord2_t adim;
     252        gfx_coord2_t bdim;
     253
     254        gfx_rect_dims(a, &adim);
     255        gfx_rect_dims(b, &bdim);
     256
     257        dest->p0.x = b->p0.x + bdim.x / 2 - adim.x / 2;
     258        dest->p0.y = b->p0.y + bdim.y / 2 - adim.y / 2;
     259
     260        dest->p1.x = dest->p0.x + adim.x;
     261        dest->p1.y = dest->p0.y + adim.y;
     262}
     263
    240264/** Sort points of a rectangle.
    241265 *
Note: See TracChangeset for help on using the changeset viewer.