后实测下Alpha混合的性能。
/**
* @brief DMA2D Alpha blending bulk
* @param pColorFG : Foregroung color
* @param pColorBG : Backgroung color
* @param pColorDst: Destination color
* @param NumItems : Number of lines
* @retval None
*/
static void _DMA_AlphaBlendingBulk(LCD_COLOR * pColorFG, LCD_COLOR * pColorBG, LCD_COLOR * pColorDst, U32 NumItems)
{
/* Wait if there is a transfer in progress */
_DMA2D_ExecOperation();
/* Take the TransferInProgress flag */
TransferInProgress = 1;
/* Setup DMA2D Configuration */
DMA2D->CR = 0x00020000UL | (1 << 9);
DMA2D->FGMAR = (U32)pColorFG;
DMA2D->BGMAR = (U32)pColorBG;
DMA2D->OMAR = (U32)pColorDst;
DMA2D->FGOR = 0;
DMA2D->BGOR = 0;
DMA2D->OOR = 0;
DMA2D->FGPFCCR = LTDC_PIXEL_FORMAT_ARGB8888;
DMA2D->BGPFCCR = LTDC_PIXEL_FORMAT_ARGB8888;
DMA2D->OPFCCR = LTDC_PIXEL_FORMAT_ARGB8888;
DMA2D->NLR = (U32)(NumItems << 16) | 1;
/* Start the transfer, and enable the transfer complete IT */
DMA2D->CR |= (1|DMA2D_IT_TC);
/* Wait for the end of the transfer */
_DMA2D_ExecOperation();
}
/**
* @brief Mixing bulk colors
* @param pColorFG : Foregroung color
* @param pColorBG : Backgroung color
* @param pColorDst: Destination color
* @param Intens : Color intensity
* @param NumItems : Number of lines
* @retval None
*/
static void _DMA_MixColorsBulk(LCD_COLOR * pColorFG, LCD_COLOR * pColorBG, LCD_COLOR * pColorDst, U8 Intens, U32 NumItems)
{
/* Wait if there is a transfer in progress */
_DMA2D_ExecOperation();
/* Take the TransferInProgress flag */
TransferInProgress = 1;
/* Setup DMA2D Configuration */
DMA2D->CR = 0x00020000UL | (1 << 9);
DMA2D->FGMAR = (U32)pColorFG;
DMA2D->BGMAR = (U32)pColorBG;
DMA2D->OMAR = (U32)pColorDst;
DMA2D->FGPFCCR = LTDC_PIXEL_FORMAT_ARGB8888
| (1UL << 16)
| ((U32)Intens << 24);
DMA2D->BGPFCCR = LTDC_PIXEL_FORMAT_ARGB8888
| (0UL << 16)
| ((U32)(255 - Intens) << 24);
DMA2D->OPFCCR = LTDC_PIXEL_FORMAT_ARGB8888;
DMA2D->NLR = (U32)(NumItems << 16) | 1;
/* Start the transfer, and enable the transfer complete IT */
DMA2D->CR |= (1|DMA2D_IT_TC);
/* Wait for the end of the transfer */
_DMA2D_ExecOperation();
}复制代码 |