Changeset 4fff3c7 in mainline
- Timestamp:
- 2018-10-19T07:51:31Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2cea4c58
- Parents:
- bae43dc
- git-author:
- Maurizio Lombardi <mlombard@…> (2018-10-18 18:55:40)
- git-committer:
- Jakub Jermar <jakub@…> (2018-10-19 07:51:31)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/softrend/compose.c
rbae43dc r4fff3c7 53 53 pixel_t compose_over(pixel_t fg, pixel_t bg) 54 54 { 55 uint16_t mf;56 uint16_t mb;57 58 55 uint8_t res_a; 59 56 uint8_t res_r; 60 57 uint8_t res_g; 61 58 uint8_t res_b; 59 uint32_t res_a_inv; 62 60 63 res_a = (ALPHA(fg) * 255 + (255 - ALPHA(fg)) * ALPHA(bg)) / 255; 64 mf = ALPHA(fg); 65 mb = (255 * 255 - ALPHA(fg) * ALPHA(bg)) / 255; 61 res_a_inv = ALPHA(bg) * (255 - ALPHA(fg)); 62 res_a = ALPHA(fg) + (res_a_inv / 255); 66 63 67 res_r = ( mf * RED(fg) + mb * RED(bg)) / 255;68 res_g = ( mf * GREEN(fg) + mb * GREEN(bg)) / 255;69 res_b = ( mf * BLUE(fg) + mb * BLUE(bg)) / 255;64 res_r = (RED(fg) * ALPHA(fg) / 255) + (RED(bg) * res_a_inv) / (255 * 255); 65 res_g = (GREEN(fg) * ALPHA(fg) / 255) + (GREEN(bg) * res_a_inv) / (255 * 255); 66 res_b = (BLUE(fg) * ALPHA(fg) / 255) + (BLUE(bg) * res_a_inv) / (255 * 255); 70 67 71 68 return PIXEL(res_a, res_r, res_g, res_b);
Note:
See TracChangeset
for help on using the changeset viewer.