Fixed inverstion issue on radio
Spoiler: only some bitmaps used to be inverted. Added masks and fonts now in inverted mode to use the same functions.
This commit is contained in:
committed by
Raphael Coeffic
parent
3bf5d8e177
commit
12ede2ca62
@@ -501,8 +501,8 @@ void DMACopyAlphaMask(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t
|
||||
#if defined(LCD_VERTICAL_INVERT)
|
||||
x = destw - (x + w);
|
||||
y = desth - (y + h);
|
||||
// srcx = srcw - (srcx + w);
|
||||
// srcy = srch - (srcy + h);
|
||||
srcx = srcw - (srcx + w);
|
||||
srcy = srch - (srcy + h);
|
||||
#endif
|
||||
|
||||
TRACE("++++++");
|
||||
@@ -510,7 +510,6 @@ void DMACopyAlphaMask(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t
|
||||
|
||||
DMA2D_InitTypeDef DMA2D_InitStruct;
|
||||
DMA2D_InitStruct.DMA2D_Mode = DMA2D_M2M_BLEND;
|
||||
//DMA2D_InitStruct.DMA2D_CMode = DMA2D_ARGB4444;
|
||||
DMA2D_InitStruct.DMA2D_CMode = CM_RGB565;
|
||||
DMA2D_InitStruct.DMA2D_OutputMemoryAdd = CONVERT_PTR_UINT(dest + y*destw + x);
|
||||
DMA2D_InitStruct.DMA2D_OutputBlue = 0;
|
||||
@@ -539,7 +538,6 @@ void DMACopyAlphaMask(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t
|
||||
DMA2D_BG_StructInit(&DMA2D_BG_InitStruct);
|
||||
DMA2D_BG_InitStruct.DMA2D_BGMA = CONVERT_PTR_UINT(dest + y*destw + x);
|
||||
DMA2D_BG_InitStruct.DMA2D_BGO = destw - w;
|
||||
// DMA2D_BG_InitStruct.DMA2D_BGCM = CM_ARGB4444;
|
||||
DMA2D_BG_InitStruct.DMA2D_BGCM = CM_RGB565;
|
||||
DMA2D_BG_InitStruct.DMA2D_BGPFC_ALPHA_MODE = NO_MODIF_ALPHA_VALUE;
|
||||
DMA2D_BG_InitStruct.DMA2D_BGPFC_ALPHA_VALUE = 0;
|
||||
|
||||
@@ -62,6 +62,8 @@ void DMACopyBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x,
|
||||
}
|
||||
}
|
||||
|
||||
// 'src' has ARGB4444
|
||||
// 'dest' has RGB565
|
||||
void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint16_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h)
|
||||
{
|
||||
#if defined(LCD_VERTICAL_INVERT)
|
||||
@@ -85,6 +87,29 @@ void DMACopyAlphaBitmap(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_
|
||||
}
|
||||
}
|
||||
|
||||
// 'src' has A8/L8?
|
||||
// 'dest' has RGB565
|
||||
void DMACopyAlphaMask(uint16_t * dest, uint16_t destw, uint16_t desth, uint16_t x, uint16_t y, const uint8_t * src, uint16_t srcw, uint16_t srch, uint16_t srcx, uint16_t srcy, uint16_t w, uint16_t h, uint16_t fg_color)
|
||||
{
|
||||
RGB_SPLIT(fg_color, red, green, blue);
|
||||
|
||||
for (coord_t line=0; line<h; line++) {
|
||||
uint16_t * p = dest + (y+line)*destw + x;
|
||||
const uint8_t * q = src + (srcy+line)*srcw + srcx;
|
||||
for (coord_t col=0; col<w; col++) {
|
||||
|
||||
uint16_t opacity = *q >> 4;// convert to 4 bits (stored in 8bit for DMA)
|
||||
uint8_t bgWeight = OPACITY_MAX - opacity;
|
||||
RGB_SPLIT(*p, bgRed, bgGreen, bgBlue);
|
||||
uint16_t r = (bgRed * bgWeight + red * opacity) / OPACITY_MAX;
|
||||
uint16_t g = (bgGreen * bgWeight + green * opacity) / OPACITY_MAX;
|
||||
uint16_t b = (bgBlue * bgWeight + blue * opacity) / OPACITY_MAX;
|
||||
*p = RGB_JOIN(r, g, b);
|
||||
p++; q++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DMABitmapConvert(uint16_t * dest, const uint8_t * src, uint16_t w, uint16_t h, uint32_t format)
|
||||
{
|
||||
if (format == DMA2D_ARGB4444) {
|
||||
|
||||
Reference in New Issue
Block a user