Skip to content

Commit

Permalink
fix premul being Extremely slow (SecondHalfGames#182)
Browse files Browse the repository at this point in the history
  • Loading branch information
msparkles authored Jul 17, 2024
1 parent 09f581b commit 0a0535c
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions crates/yakui-wgpu/src/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,9 +142,7 @@ fn wgpu_address_mode(address_mode: AddressMode) -> wgpu::AddressMode {

fn premultiply_alpha(texture: &Texture) -> Cow<'_, Texture> {
fn premul(a: u8, b: u8) -> u8 {
let a = (a as f32) / 255.0;
let b = (b as f32) / 255.0;
((a * b) * 255.0).round() as u8
(((a as u32) * (b as u32) + 255) >> 8) as u8
}

match texture.format() {
Expand Down

0 comments on commit 0a0535c

Please sign in to comment.