From ce61fd857b721f7a044a25845c3e8ee3cee1e245 Mon Sep 17 00:00:00 2001 From: Melissa LeBlanc-Williams Date: Thu, 10 Aug 2023 08:15:18 -0700 Subject: [PATCH] Bug fix for skip on only one bmp --- shared-module/bitmaptools/__init__.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/shared-module/bitmaptools/__init__.c b/shared-module/bitmaptools/__init__.c index eebb7f7c24..2054ff9cab 100644 --- a/shared-module/bitmaptools/__init__.c +++ b/shared-module/bitmaptools/__init__.c @@ -972,10 +972,16 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma } } else if (blend_source1) { // Apply iFactor1 to source1 only - pixel = spix1 * ifactor1 / 256; + int r = (spix1 & r_mask) * ifactor1 / 256; + int g = (spix1 & g_mask) * ifactor1 / 256; + int b = (spix1 & b_mask) * ifactor1 / 256; + pixel = r | g | b; } else if (blend_source2) { // Apply iFactor2 to source1 only - pixel = spix2 * ifactor2 / 256; + int r = (spix2 & r_mask) * ifactor2 / 256; + int g = (spix2 & g_mask) * ifactor2 / 256; + int b = (spix2 & b_mask) * ifactor2 / 256; + pixel = r | g | b; } else { // Use the destination value pixel = *dptr;