Changeset 6a87f28 in mainline for uspace/app/gfxdemo/gfxdemo.c
- Timestamp:
- 2021-02-25T16:48:13Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- bac8acab
- Parents:
- 26853ebc
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/gfxdemo/gfxdemo.c
r26853ebc r6a87f28 185 185 for (j = 0; j < h; j++) { 186 186 pixelmap_put_pixel(&pixelmap, i, j, 187 PIXEL( 255, (i % 30) < 3 ? 255 : 0,187 PIXEL(0, (i % 30) < 3 ? 255 : 0, 188 188 (j % 30) < 3 ? 255 : 0, i / 2)); 189 189 } … … 221 221 k = i * i + j * j; 222 222 pixelmap_put_pixel(&pixelmap, i, j, 223 PIXEL( 255, k, k, k));223 PIXEL(0, k, k, k)); 224 224 } 225 225 } … … 256 256 k = i * i + j * j; 257 257 pixelmap_put_pixel(&pixelmap, i, j, 258 k < w * w / 2 ? PIXEL( 255, 0, 255, 0) :258 k < w * w / 2 ? PIXEL(0, 0, 255, 0) : 259 259 PIXEL(0, 255, 0, 255)); 260 260 } … … 469 469 return EOK; 470 470 471 rc = gfx_typeface_open(gc, "/data/font/helena.tpf", &tface); 472 if (rc != EOK) { 473 printf("Error opening typeface\n"); 474 goto error; 475 } 476 477 finfo = gfx_typeface_first_font(tface); 478 if (finfo == NULL) { 479 printf("Typeface contains no font.\n"); 480 rc = ENOENT; 481 goto error; 482 } 483 484 rc = gfx_font_open(finfo, &font); 485 if (rc != EOK) { 486 printf("Error opening font.\n"); 487 goto error; 471 /* XXX Crude way of detecting text mode */ 472 if (w < 256) { 473 /* Create dummy font for text mode */ 474 rc = gfx_typeface_create(gc, &tface); 475 if (rc != EOK) { 476 printf("Error creating typeface\n"); 477 goto error; 478 } 479 480 rc = gfx_font_create_textmode(tface, &font); 481 if (rc != EOK) { 482 printf("Error creating font\n"); 483 goto error; 484 } 485 } else { 486 /* Load font */ 487 rc = gfx_typeface_open(gc, "/data/font/helena.tpf", &tface); 488 if (rc != EOK) { 489 printf("Error opening typeface\n"); 490 goto error; 491 } 492 493 finfo = gfx_typeface_first_font(tface); 494 if (finfo == NULL) { 495 printf("Typeface contains no font.\n"); 496 rc = ENOENT; 497 goto error; 498 } 499 500 rc = gfx_font_open(finfo, &font); 501 if (rc != EOK) { 502 printf("Error opening font.\n"); 503 goto error; 504 } 488 505 } 489 506
Note:
See TracChangeset
for help on using the changeset viewer.