SecondHalfGames / yakui

yakui is a declarative Rust UI library for games
Apache License 2.0
228 stars 20 forks source link

commit that adds pre-multiplied to images, also changes alpha for colored container? #180

Open cybersoulK opened 1 month ago

cybersoulK commented 1 month ago

https://github.com/SecondHalfGames/yakui/commit/f893ad1ead7bad401c0b0d62180f95fd114d6efa

image image

The first image is before the commit, second is after the commit. The elements are colored_box and colored_box_container

LPGhatguy commented 1 month ago

Interesting! This should be an easy fix and probably impacts our game too.

msparkles commented 1 month ago

@LPGhatguy we're noticing in #179 that the coloured texts are already premul'd (at least as far as we can tell)

We also found a really bad performance issue in the alpha premultiplication.

We're committing a fix for those because it heavily affects coloured texts, it takes like 5s to write 3 coloured text characters on release right now, Oops!

msparkles commented 1 month ago

P.S. We ran a profiler on yakui example to see that premul'd alpha really is taking too long. It's all on .round()

LPGhatguy commented 1 month ago

@msparkles Those changes seem useful even outside of cosmic text. If the conversion that removes round is the same, I'd take that in a separate PR.

I wonder where the best place to handle the premultiplication in the pipeline is.

msparkles commented 1 month ago

Should we cherry-pick them into a separate branch?