Skip to content

Commit ce61fd8

Browse files
committed
Bug fix for skip on only one bmp
1 parent db23a9c commit ce61fd8

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

shared-module/bitmaptools/__init__.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -972,10 +972,16 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma
972972
}
973973
} else if (blend_source1) {
974974
// Apply iFactor1 to source1 only
975-
pixel = spix1 * ifactor1 / 256;
975+
int r = (spix1 & r_mask) * ifactor1 / 256;
976+
int g = (spix1 & g_mask) * ifactor1 / 256;
977+
int b = (spix1 & b_mask) * ifactor1 / 256;
978+
pixel = r | g | b;
976979
} else if (blend_source2) {
977980
// Apply iFactor2 to source1 only
978-
pixel = spix2 * ifactor2 / 256;
981+
int r = (spix2 & r_mask) * ifactor2 / 256;
982+
int g = (spix2 & g_mask) * ifactor2 / 256;
983+
int b = (spix2 & b_mask) * ifactor2 / 256;
984+
pixel = r | g | b;
979985
} else {
980986
// Use the destination value
981987
pixel = *dptr;

0 commit comments

Comments
 (0)