Enable L8 mode for alphablend

This commit is contained in:
Jeff Epler 2021-11-05 11:26:07 -05:00
parent 8e8c44afea
commit dfafab675f
2 changed files with 1 additions and 6 deletions

View File

@ -296,13 +296,11 @@ STATIC mp_obj_t bitmaptools_alphablend(size_t n_args, const mp_obj_t *pos_args,
}
switch (colorspace) {
#if 0
case DISPLAYIO_COLORSPACE_L8:
if (destination->bits_per_value != 8) {
mp_raise_ValueError(translate("For L8 colorspace, input bitmap must have 8 bits per pixel"));
}
break;
#endif
case DISPLAYIO_COLORSPACE_RGB565:
case DISPLAYIO_COLORSPACE_RGB565_SWAPPED:

View File

@ -610,7 +610,6 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma
int ifactor1 = (int)(factor1 * 256);
int ifactor2 = (int)(factor2 * 256);
#if 0
if (colorspace == DISPLAYIO_COLORSPACE_L8) {
for (int y = 0; y < dest->height; y++) {
uint8_t *dptr = (uint8_t *)(dest->data + y * dest->stride);
@ -622,9 +621,7 @@ void common_hal_bitmaptools_alphablend(displayio_bitmap_t *dest, displayio_bitma
*dptr++ = MIN(255, MAX(0, pixel));
}
}
} else
#endif
{
} else {
bool swap = (colorspace == DISPLAYIO_COLORSPACE_RGB565_SWAPPED) || (colorspace == DISPLAYIO_COLORSPACE_BGR565_SWAPPED);
for (int y = 0; y < dest->height; y++) {
uint16_t *dptr = (uint16_t *)(dest->data + y * dest->stride);