File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -227,11 +227,13 @@ pub fn unpremultiply_rgba16(in_place: &mut [u16], bit_depth: u32) {
227227/// * `in_place`: Slice to where premultiply
228228///
229229pub fn premultiply_rgba_f32 ( in_place : & mut [ f32 ] ) {
230+ // Almost all loops are not auto-vectorised without doing anything dirty.
231+ // So everywhere is just added something beautiful.
230232 for chunk in in_place. chunks_exact_mut ( 4 ) {
231233 let a = chunk[ 3 ] ;
232- chunk[ 0 ] = chunk [ 0 ] * a;
233- chunk[ 1 ] = chunk [ 1 ] * a;
234- chunk[ 2 ] = chunk [ 2 ] * a;
234+ chunk[ 0 ] *= a;
235+ chunk[ 1 ] *= a;
236+ chunk[ 2 ] *= a;
235237 chunk[ 3 ] = a;
236238 }
237239}
@@ -253,6 +255,7 @@ pub fn unpremultiply_rgba_f32(in_place: &mut [f32]) {
253255 chunk[ 0 ] *= a_recip;
254256 chunk[ 1 ] *= a_recip;
255257 chunk[ 2 ] *= a_recip;
258+ chunk[ 3 ] = a;
256259 }
257260 }
258261}
You can’t perform that action at this time.
0 commit comments