Changeset 0d62c10 in mainline
- Timestamp:
- 2020-10-09T20:27:24Z (4 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f80690a
- Parents:
- 8bf9058
- Location:
- uspace
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/gfxdemo/gfxdemo.c
r8bf9058 r0d62c10 590 590 goto error; 591 591 592 gfx_color_delete(color); 593 592 594 gfx_text_fmt_init(&fmt); 593 595 594 596 for (i = 0; i < 8; i++) { 597 rc = gfx_color_new_rgb_i16((i & 4) ? 0xffff : 0, 598 (i & 2) ? 0xffff : 0, (i & 1) ? 0xffff : 0, &color); 599 if (rc != EOK) 600 goto error; 601 602 rc = gfx_set_color(gc, color); 603 if (rc != EOK) 604 goto error; 605 595 606 pos.x = w / 20; 596 607 pos.y = (7 + i) * h / 15; … … 598 609 if (rc != EOK) 599 610 goto error; 611 612 gfx_color_delete(color); 600 613 } 601 614 … … 605 618 break; 606 619 } 607 608 gfx_color_delete(color);609 620 610 621 gfx_font_close(font); -
uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.c
r8bf9058 r0d62c10 383 383 384 384 /* Check that we support all required flags */ 385 if ((params->flags & ~ bmpf_color_key) != 0)385 if ((params->flags & ~(bmpf_color_key | bmpf_colorize)) != 0) 386 386 return ENOTSUP; 387 387 … … 392 392 gfx_coord2_subtract(¶ms->rect.p1, ¶ms->rect.p0, &dim); 393 393 dcbm->rect = params->rect; 394 dcbm->flags = params->flags; 394 395 395 396 if (alloc == NULL) { … … 487 488 gfx_rect_clip(&srect, &skfbrect, &crect); 488 489 489 // XXX bmpf_color_key 490 for (pos.y = crect.p0.y; pos.y < crect.p1.y; pos.y++) { 491 for (pos.x = crect.p0.x; pos.x < crect.p1.x; pos.x++) { 492 gfx_coord2_subtract(&pos, &dcbm->rect.p0, &sp); 493 gfx_coord2_add(&pos, &offs, &dp); 494 495 color = pixelmap_get_pixel(&pbm, sp.x, sp.y); 496 dispc->active_fb.pixel2visual(dispc->fb_data + 497 FB_POS(dispc, dp.x, dp.y), color); 490 if ((dcbm->flags & bmpf_color_key) == 0) { 491 /* Simple copy */ 492 for (pos.y = crect.p0.y; pos.y < crect.p1.y; pos.y++) { 493 for (pos.x = crect.p0.x; pos.x < crect.p1.x; pos.x++) { 494 gfx_coord2_subtract(&pos, &dcbm->rect.p0, &sp); 495 gfx_coord2_add(&pos, &offs, &dp); 496 497 color = pixelmap_get_pixel(&pbm, sp.x, sp.y); 498 dispc->active_fb.pixel2visual(dispc->fb_data + 499 FB_POS(dispc, dp.x, dp.y), color); 500 } 501 } 502 } else if ((dcbm->flags & bmpf_colorize) == 0) { 503 /* Color key */ 504 for (pos.y = crect.p0.y; pos.y < crect.p1.y; pos.y++) { 505 for (pos.x = crect.p0.x; pos.x < crect.p1.x; pos.x++) { 506 gfx_coord2_subtract(&pos, &dcbm->rect.p0, &sp); 507 gfx_coord2_add(&pos, &offs, &dp); 508 509 color = pixelmap_get_pixel(&pbm, sp.x, sp.y); 510 if (color != dcbm->key_color) { 511 dispc->active_fb.pixel2visual(dispc->fb_data + 512 FB_POS(dispc, dp.x, dp.y), color); 513 } 514 } 515 } 516 } else { 517 /* Color key & colorize */ 518 for (pos.y = crect.p0.y; pos.y < crect.p1.y; pos.y++) { 519 for (pos.x = crect.p0.x; pos.x < crect.p1.x; pos.x++) { 520 gfx_coord2_subtract(&pos, &dcbm->rect.p0, &sp); 521 gfx_coord2_add(&pos, &offs, &dp); 522 523 color = pixelmap_get_pixel(&pbm, sp.x, sp.y); 524 if (color != dcbm->key_color) { 525 dispc->active_fb.pixel2visual(dispc->fb_data + 526 FB_POS(dispc, dp.x, dp.y), 527 dcbm->dispc->color); 528 } 529 } 498 530 } 499 531 } -
uspace/drv/fb/amdm37x_dispc/amdm37x_dispc.h
r8bf9058 r0d62c10 68 68 69 69 typedef struct { 70 /* Containing display controller */ 70 71 amdm37x_dispc_t *dispc; 72 /** Allocation info */ 71 73 gfx_bitmap_alloc_t alloc; 74 /** @c true if we allocated the bitmap, @c false if allocated by caller */ 75 bool myalloc; 76 /** Rectangle covered by bitmap */ 72 77 gfx_rect_t rect; 73 bool myalloc; 78 /** Bitmap flags */ 79 gfx_bitmap_flags_t flags; 80 /** Key color */ 81 pixel_t key_color; 74 82 } amdm37x_bitmap_t; 75 83 -
uspace/drv/fb/kfb/port.c
r8bf9058 r0d62c10 200 200 201 201 /* Check that we support all required flags */ 202 if ((params->flags & ~ bmpf_color_key) != 0)202 if ((params->flags & ~(bmpf_color_key | bmpf_colorize)) != 0) 203 203 return ENOTSUP; 204 204 … … 307 307 308 308 if ((kfbbm->flags & bmpf_color_key) != 0) { 309 /* Simple copy */ 309 310 for (pos.y = crect.p0.y; pos.y < crect.p1.y; pos.y++) { 310 311 for (pos.x = crect.p0.x; pos.x < crect.p1.x; pos.x++) { … … 319 320 } 320 321 } 322 } else if ((kfbbm->flags & bmpf_colorize) != 0) { 323 /* Color key */ 324 for (pos.y = crect.p0.y; pos.y < crect.p1.y; pos.y++) { 325 for (pos.x = crect.p0.x; pos.x < crect.p1.x; pos.x++) { 326 gfx_coord2_subtract(&pos, &kfbbm->rect.p0, &sp); 327 gfx_coord2_add(&pos, &offs, &dp); 328 329 color = pixelmap_get_pixel(&pbm, sp.x, sp.y); 330 kfb->pixel2visual(kfb->addr + 331 FB_POS(kfb, dp.x, dp.y), color); 332 } 333 } 321 334 } else { 335 /* Color key & colorize */ 322 336 for (pos.y = crect.p0.y; pos.y < crect.p1.y; pos.y++) { 323 337 for (pos.x = crect.p0.x; pos.x < crect.p1.x; pos.x++) { -
uspace/lib/congfx/src/console.c
r8bf9058 r0d62c10 207 207 208 208 /* Check that we support all requested flags */ 209 if ((params->flags & ~ bmpf_color_key) != 0)209 if ((params->flags & ~(bmpf_color_key | bmpf_colorize)) != 0) 210 210 return ENOTSUP; 211 211 … … 296 296 297 297 if ((cbm->flags & bmpf_color_key) == 0) { 298 /* Simple copy */ 298 299 for (y = crect.p0.y; y < crect.p1.y; y++) { 299 300 console_set_pos(cbm->cgc->con, crect.p0.x, y); … … 312 313 } 313 314 } 314 } else { 315 } else if ((cbm->flags & bmpf_colorize) == 0) { 316 /* Color key */ 315 317 for (y = crect.p0.y; y < crect.p1.y; y++) { 316 318 for (x = crect.p0.x; x < crect.p1.x; x++) { … … 332 334 } 333 335 } 336 } else { 337 /* Color key & colorize */ 338 console_set_rgb_color(cbm->cgc->con, cbm->cgc->clr, 339 cbm->cgc->clr); 340 341 for (y = crect.p0.y; y < crect.p1.y; y++) { 342 for (x = crect.p0.x; x < crect.p1.x; x++) { 343 344 clr = pixelmap_get_pixel(&pixelmap, 345 x - offs.x - cbm->rect.p0.x, 346 y - offs.y - cbm->rect.p0.y); 347 348 if (clr != cbm->key_color) { 349 console_set_pos(cbm->cgc->con, x, y); 350 rv = fputc('X', cbm->cgc->fout); 351 if (rv < 0) 352 return EIO; 353 354 console_flush(cbm->cgc->con); 355 } 356 357 } 358 } 334 359 } 335 360 -
uspace/lib/gfx/include/types/gfx/bitmap.h
r8bf9058 r0d62c10 47 47 /** Bitmap flags */ 48 48 typedef enum { 49 /** Directly map GC output into this bitmap */ 50 bmpf_direct_output = 0x1, 49 51 /** Enable color key */ 50 bmpf_color_key = 0x 1,51 /** Directly map GC output into this bitmap*/52 bmpf_ direct_output = 0x252 bmpf_color_key = 0x2, 53 /** Paint non-background pixels with current drawing color */ 54 bmpf_colorize = 0x4 53 55 } gfx_bitmap_flags_t; 54 56 -
uspace/lib/gfxfont/src/font.c
r8bf9058 r0d62c10 122 122 gfx_bitmap_params_init(¶ms); 123 123 params.rect = font->rect; 124 params.flags = bmpf_color_key ;124 params.flags = bmpf_color_key | bmpf_colorize; 125 125 params.key_color = PIXEL(0, 0, 0, 0); 126 126 … … 366 366 if (nrect->p1.y - nrect->p0.y > params.rect.p1.y) 367 367 params.rect.p1.y = nrect->p1.y - nrect->p0.y; 368 params.flags = bmpf_color_key ;368 params.flags = bmpf_color_key | bmpf_colorize; 369 369 params.key_color = PIXEL(0, 0, 0, 0); 370 370 … … 705 705 params.rect.p1.x = width; 706 706 params.rect.p1.y = height; 707 params.flags = bmpf_color_key ;707 params.flags = bmpf_color_key | bmpf_colorize; 708 708 params.key_color = PIXEL(0, 0, 0, 0); 709 709 -
uspace/lib/gfxfont/src/text.c
r8bf9058 r0d62c10 135 135 case gfx_valign_bottom: 136 136 cpos.y -= fmetrics.descent; 137 137 break; 138 138 default: 139 139 break; -
uspace/lib/memgfx/src/memgc.c
r8bf9058 r0d62c10 225 225 226 226 /* Check that we support all requested flags */ 227 if ((params->flags & ~(bmpf_color_key | bmpf_direct_output)) != 0) 227 if ((params->flags & ~(bmpf_color_key | bmpf_colorize | 228 bmpf_direct_output)) != 0) 228 229 return ENOTSUP; 229 230 … … 367 368 /* Nothing to do */ 368 369 } else if ((mbm->flags & bmpf_color_key) == 0) { 370 /* Simple copy */ 369 371 for (y = drect.p0.y; y < drect.p1.y; y++) { 370 372 for (x = drect.p0.x; x < drect.p1.x; x++) { … … 375 377 } 376 378 } 377 } else { 379 } else if ((mbm->flags & bmpf_colorize) == 0) { 380 /* Color key */ 378 381 for (y = drect.p0.y; y < drect.p1.y; y++) { 379 382 for (x = drect.p0.x; x < drect.p1.x; x++) { … … 385 388 } 386 389 } 390 } else { 391 /* Color key & colorization */ 392 for (y = drect.p0.y; y < drect.p1.y; y++) { 393 for (x = drect.p0.x; x < drect.p1.x; x++) { 394 pixel = pixelmap_get_pixel(&smap, 395 x - mbm->rect.p0.x - offs.x, 396 y - mbm->rect.p0.y - offs.y); 397 if (pixel != mbm->key_color) 398 pixelmap_put_pixel(&dmap, x, y, 399 mbm->mgc->color); 400 } 401 } 387 402 } 388 403 -
uspace/srv/hid/rfb/main.c
r8bf9058 r0d62c10 196 196 197 197 /* Check that we support all required flags */ 198 if ((params->flags & ~ bmpf_color_key) != 0)198 if ((params->flags & ~(bmpf_color_key | bmpf_colorize)) != 0) 199 199 return ENOTSUP; 200 200 … … 287 287 288 288 if ((rfbbm->flags & bmpf_color_key) == 0) { 289 /* Simple copy */ 289 290 for (y = srect.p0.y; y < srect.p1.y; y++) { 290 291 for (x = srect.p0.x; x < srect.p1.x; x++) { … … 294 295 } 295 296 } 296 } else { 297 } else if ((rfbbm->flags & bmpf_colorize) == 0) { 298 /* Color key */ 297 299 for (y = srect.p0.y; y < srect.p1.y; y++) { 298 300 for (x = srect.p0.x; x < srect.p1.x; x++) { … … 304 306 } 305 307 } 308 } else { 309 /* Color key & colorization */ 310 for (y = srect.p0.y; y < srect.p1.y; y++) { 311 for (x = srect.p0.x; x < srect.p1.x; x++) { 312 color = pixelmap_get_pixel(&pbm, x, y); 313 if (color != rfbbm->key_color) { 314 pixelmap_put_pixel(&rfbbm->rfb->rfb.framebuffer, 315 x + offs.x, y + offs.y, 316 rfbbm->rfb->color); 317 } 318 } 319 } 306 320 } 307 321
Note:
See TracChangeset
for help on using the changeset viewer.