Changeset 4583015 in mainline for uspace/app/gfxdemo/gfxdemo.c


Ignore:
Timestamp:
2022-03-07T16:10:44Z (3 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
ca2680d
Parents:
5c27e77
Message:

Add font to gfx_text_fmt_t

This is quite logical and saves us one argument that we need to pass to
all text formatting functions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/gfxdemo/gfxdemo.c

    r5c27e77 r4583015  
    238238
    239239                gfx_text_fmt_init(&fmt);
     240                fmt.font = font;
    240241                fmt.color = color;
    241242                fmt.halign = gfx_halign_center;
     
    244245                pos.x = w / 2;
    245246                pos.y = h - 1;
    246                 rc = gfx_puttext(font, &pos, &fmt, text);
     247                rc = gfx_puttext(&pos, &fmt, text);
    247248                if (rc != EOK) {
    248249                        printf("Error rendering text.\n");
     
    689690
    690691        gfx_text_fmt_init(&fmt);
     692        fmt.font = font;
    691693        fmt.color = color;
    692694
    693695        pos.x = rect.p0.x;
    694696        pos.y = rect.p0.y;
    695         rc = gfx_puttext(font, &pos, &fmt, "Top left");
     697        rc = gfx_puttext(&pos, &fmt, "Top left");
    696698        if (rc != EOK) {
    697699                printf("Error rendering text.\n");
     
    702704        pos.y = rect.p0.y;
    703705        fmt.halign = gfx_halign_center;
    704         rc = gfx_puttext(font, &pos, &fmt, "Top center");
     706        rc = gfx_puttext(&pos, &fmt, "Top center");
    705707        if (rc != EOK)
    706708                goto error;
     
    709711        pos.y = rect.p0.y;
    710712        fmt.halign = gfx_halign_right;
    711         rc = gfx_puttext(font, &pos, &fmt, "Top right");
     713        rc = gfx_puttext(&pos, &fmt, "Top right");
    712714        if (rc != EOK)
    713715                goto error;
     
    718720        pos.y = (rect.p0.y + rect.p1.y - 1) / 2;
    719721        fmt.halign = gfx_halign_left;
    720         rc = gfx_puttext(font, &pos, &fmt, "Center left");
     722        rc = gfx_puttext(&pos, &fmt, "Center left");
    721723        if (rc != EOK)
    722724                goto error;
     
    725727        pos.y = (rect.p0.y + rect.p1.y - 1) / 2;
    726728        fmt.halign = gfx_halign_center;
    727         rc = gfx_puttext(font, &pos, &fmt, "Center");
     729        rc = gfx_puttext(&pos, &fmt, "Center");
    728730        if (rc != EOK)
    729731                goto error;
     
    732734        pos.y = (rect.p0.y + rect.p1.y - 1) / 2;
    733735        fmt.halign = gfx_halign_right;
    734         rc = gfx_puttext(font, &pos, &fmt, "Center right");
     736        rc = gfx_puttext(&pos, &fmt, "Center right");
    735737        if (rc != EOK)
    736738                goto error;
     
    741743        pos.y = rect.p1.y - 1;
    742744        fmt.halign = gfx_halign_left;
    743         rc = gfx_puttext(font, &pos, &fmt, "Bottom left");
     745        rc = gfx_puttext(&pos, &fmt, "Bottom left");
    744746        if (rc != EOK)
    745747                goto error;
     
    748750        pos.y = rect.p1.y;
    749751        fmt.halign = gfx_halign_center;
    750         rc = gfx_puttext(font, &pos, &fmt, "Bottom center");
     752        rc = gfx_puttext(&pos, &fmt, "Bottom center");
    751753        if (rc != EOK)
    752754                goto error;
     
    755757        pos.y = rect.p1.y;
    756758        fmt.halign = gfx_halign_right;
    757         rc = gfx_puttext(font, &pos, &fmt, "Bottom right");
     759        rc = gfx_puttext(&pos, &fmt, "Bottom right");
    758760        if (rc != EOK)
    759761                goto error;
     
    762764
    763765        gfx_text_fmt_init(&fmt);
     766        fmt.font = font;
    764767
    765768        for (i = 0; i < 8; i++) {
     
    780783                pos.x = w / 20;
    781784                pos.y = (6 + i) * h / 15;
    782                 rc = gfx_puttext(font, &pos, &fmt, "The quick brown fox jumps over the lazy dog.");
     785                rc = gfx_puttext(&pos, &fmt, "The quick brown fox jumps over the lazy dog.");
    783786                if (rc != EOK)
    784787                        goto error;
Note: See TracChangeset for help on using the changeset viewer.