Ignore:
File:
1 edited

Legend:

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

    r901b302 r4583015  
    244244
    245245                pos.x = w / 2;
    246                 pos.y = h;
     246                pos.y = h - 1;
    247247                rc = gfx_puttext(&pos, &fmt, text);
    248248                if (rc != EOK) {
     
    801801}
    802802
    803 /** Run text abbreviation demo on a graphic context.
    804  *
    805  * @param gc Graphic context
    806  * @param w Width
    807  * @param h Height
    808  */
    809 static errno_t demo_text_abbr(gfx_context_t *gc, gfx_coord_t w, gfx_coord_t h)
    810 {
    811         gfx_color_t *color = NULL;
    812         gfx_rect_t rect;
    813         gfx_coord2_t pos;
    814         gfx_text_fmt_t fmt;
    815         int i;
    816         errno_t rc;
    817 
    818         if (quit)
    819                 return EOK;
    820 
    821         rc = demo_begin(gc, w, h, "Text abbreviation");
    822         if (rc != EOK)
    823                 goto error;
    824 
    825         for (i = 0; i < 11; i++) {
    826 
    827                 rc = gfx_color_new_rgb_i16(0, 0, 0x8000, &color);
    828                 if (rc != EOK)
    829                         goto error;
    830 
    831                 rc = gfx_set_color(gc, color);
    832                 if (rc != EOK)
    833                         goto error;
    834 
    835                 rect.p0.x = w / 20;
    836                 rect.p0.y = (2 + 2 * i) * h / 25;
    837                 rect.p1.x = w - w / 20 - w * i / 12;
    838                 rect.p1.y = (3 + 2 * i) * h / 25;
    839 
    840                 rc = gfx_fill_rect(gc, &rect);
    841                 if (rc != EOK)
    842                         goto error;
    843 
    844                 gfx_color_delete(color);
    845 
    846                 if (demo_is_text(w, h)) {
    847                         rc = gfx_color_new_ega(0x1f, &color);
    848                         if (rc != EOK)
    849                                 goto error;
    850                 } else {
    851                         rc = gfx_color_new_rgb_i16(0xffff, 0xffff, 0xffff,
    852                             &color);
    853                         if (rc != EOK)
    854                                 goto error;
    855                 }
    856 
    857                 gfx_text_fmt_init(&fmt);
    858                 fmt.font = font;
    859                 fmt.color = color;
    860                 fmt.abbreviate = true;
    861                 fmt.width = rect.p1.x - rect.p0.x;
    862 
    863                 pos.x = rect.p0.x;
    864                 pos.y = rect.p0.y;
    865                 rc = gfx_puttext(&pos, &fmt,
    866                     "The quick brow fox jumps over the lazy dog!");
    867                 if (rc != EOK) {
    868                         printf("Error rendering text.\n");
    869                         goto error;
    870                 }
    871         }
    872 
    873         for (i = 0; i < 10; i++) {
    874                 fibril_usleep(500 * 1000);
    875                 if (quit)
    876                         break;
    877         }
    878 
    879         return EOK;
    880 error:
    881         return rc;
    882 }
    883 
    884803/** Run clipping demo on a graphic context.
    885804 *
     
    1014933
    1015934                rc = demo_text(gc, w, h);
    1016                 if (rc != EOK)
    1017                         goto error;
    1018 
    1019                 rc = demo_text_abbr(gc, w, h);
    1020935                if (rc != EOK)
    1021936                        goto error;
     
    11541069        params.rect.p1.x = 400;
    11551070        params.rect.p1.y = 300;
    1156         params.caption = "GFX Demo";
    11571071
    11581072        rc = display_window_create(display, &params, &wnd_cb, NULL, &window);
Note: See TracChangeset for help on using the changeset viewer.