if (CurrentLayer == LCD_BACKGROUND_LAYER)
{
/* reconfigure layer size in accordance with the picture */
LTDC_LayerSize(LTDC_Layer1, width, height);
LTDC_ReloadConfig(LTDC_VBReload);
/* Reconfigure the Layer pixel format in accordance with the picture */
if ((bit_pixel/8) == 4)
{
LTDC_LayerPixelFormat(LTDC_Layer1, LTDC_Pixelformat_ARGB8888);
LTDC_ReloadConfig(LTDC_VBReload);
}
else if ((bit_pixel/8) == 2)
{
LTDC_LayerPixelFormat(LTDC_Layer1, LTDC_Pixelformat_RGB565);
LTDC_ReloadConfig(LTDC_VBReload);
}
else
{
LTDC_LayerPixelFormat(LTDC_Layer1, LTDC_Pixelformat_RGB888);
LTDC_ReloadConfig(LTDC_VBReload);
}
}
else
{
/* reconfigure layer size in accordance with the picture */
LTDC_LayerSize(LTDC_Layer2, width, height);
LTDC_ReloadConfig(LTDC_VBReload);
/* Reconfigure the Layer pixel format in accordance with the picture */
if ((bit_pixel/8) == 4)
{
LTDC_LayerPixelFormat(LTDC_Layer2, LTDC_Pixelformat_ARGB8888);
LTDC_ReloadConfig(LTDC_VBReload);
}
else if ((bit_pixel/8) == 2)
{
LTDC_LayerPixelFormat(LTDC_Layer2, LTDC_Pixelformat_RGB565);
LTDC_ReloadConfig(LTDC_VBReload);
}
else
{
LTDC_LayerPixelFormat(LTDC_Layer2, LTDC_Pixelformat_RGB888);
LTDC_ReloadConfig(LTDC_VBReload);
}
}
/* compute the real size of the picture (without the header)) */
size = (size - index);
/* bypass the bitmap header */
BmpAddress += index;
/* start copie image from the bottom */
Address += width*(height-1)*(bit_pixel/8);