Ignore:
File:
1 edited

Legend:

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

    r400a16d rda15002  
    11/*
    2  * Copyright (c) 2021 Jiri Svoboda
     2 * Copyright (c) 2020 Jiri Svoboda
    33 * All rights reserved.
    44 *
     
    7373static gfx_coord_t vpad;
    7474
    75 /** Determine if we are running in text mode.
    76  *
    77  * @param w Screen width
    78  * @param h Screen height
    79  * @return @c true iff we are running in text mode
    80  */
    81 static bool demo_is_text(gfx_coord_t w, gfx_coord_t h)
    82 {
    83         // XXX Need a proper way to determine text mode
    84         return w <= 80;
    85 }
    86 
    8775/** Clear screen.
    8876 *
     
    227215
    228216        if (font != NULL) {
    229                 if (demo_is_text(w, h)) {
    230                         rc = gfx_color_new_ega(0x1e, &color);
    231                         if (rc != EOK)
    232                                 goto error;
    233                 } else {
    234                         rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color);
    235                         if (rc != EOK)
    236                                 goto error;
    237                 }
     217                rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color);
     218                if (rc != EOK)
     219                        goto error;
    238220
    239221                gfx_text_fmt_init(&fmt);
     
    678660        gfx_color_delete(color);
    679661
    680         if (demo_is_text(w, h)) {
    681                 rc = gfx_color_new_ega(0x1f, &color);
    682                 if (rc != EOK)
    683                         goto error;
    684         } else {
    685                 rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color);
    686                 if (rc != EOK)
    687                         goto error;
    688         }
     662        rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff, &color);
     663        if (rc != EOK)
     664                goto error;
    689665
    690666        gfx_text_fmt_init(&fmt);
     
    706682                goto error;
    707683
    708         pos.x = rect.p1.x;
     684        pos.x = rect.p1.x - 1;
    709685        pos.y = rect.p0.y;
    710686        fmt.halign = gfx_halign_right;
     
    729705                goto error;
    730706
    731         pos.x = rect.p1.x;
     707        pos.x = rect.p1.x - 1;
    732708        pos.y = (rect.p0.y + rect.p1.y - 1) / 2;
    733709        fmt.halign = gfx_halign_right;
     
    746722
    747723        pos.x = (rect.p0.x + rect.p1.x - 1) / 2;
    748         pos.y = rect.p1.y;
     724        pos.y = rect.p1.y - 1;
    749725        fmt.halign = gfx_halign_center;
    750726        rc = gfx_puttext(font, &pos, &fmt, "Bottom center");
     
    752728                goto error;
    753729
    754         pos.x = rect.p1.x;
    755         pos.y = rect.p1.y;
     730        pos.x = rect.p1.x - 1;
     731        pos.y = rect.p1.y - 1;
    756732        fmt.halign = gfx_halign_right;
    757733        rc = gfx_puttext(font, &pos, &fmt, "Bottom right");
     
    764740
    765741        for (i = 0; i < 8; i++) {
    766                 if (demo_is_text(w, h)) {
    767                         rc = gfx_color_new_ega(i != 0 ? i : 0x10, &color);
    768                         if (rc != EOK)
    769                                 goto error;
    770                 } else {
    771                         rc = gfx_color_new_rgb_i16((i & 4) ? 0xffff : 0,
    772                             (i & 2) ? 0xffff : 0, (i & 1) ? 0xffff : 0, &color);
    773                         if (rc != EOK)
    774                                 goto error;
    775                 }
     742                rc = gfx_color_new_rgb_i16((i & 4) ? 0xffff : 0,
     743                    (i & 2) ? 0xffff : 0, (i & 1) ? 0xffff : 0, &color);
     744                if (rc != EOK)
     745                        goto error;
    776746
    777747                fmt.color = color;
Note: See TracChangeset for help on using the changeset viewer.